Export XHTML Pages

When a Web uses one of the Markdown Text Filters, and you export
all the pages as a zip file, you'd like the MathML and SVG to
render when the pages are viewed locally. This means saving them
with a .xhtml extension. Users of non-XHTML-capable browsers or
Textile users should still get .html files.
This commit is contained in:
Jacques Distler 2009-01-23 11:02:16 -06:00
parent 13b7e1d766
commit 0b2a6935a2
6 changed files with 64 additions and 20 deletions

View file

@ -61,7 +61,7 @@ module Chunk
end
def unmask
@content.sub!(/#{mask}/){|s| s.replace @unmask_text}
@content.sub!(mask){|s| s.replace @unmask_text}
end
def rendered?
@ -73,7 +73,7 @@ module Chunk
end
def revert
@content.sub!(/#{mask}/){|s| s.replace @text}
@content.sub!(mask){|s| s.replace @text}
# unregister
@content.delete_chunk(self)
end

View file

@ -24,7 +24,7 @@ module Literal
# A literal chunk that protects HTML tags from wiki rendering.
class Tags < AbstractLiteral
TAGS_PATTERN = Regexp.new('<[-a-zA-Z]+[^>]*?>', Regexp::MULTILINE)
TAGS_PATTERN = Regexp.new('</?[-a-zA-Z:]+\b[^>]*?>', Regexp::MULTILINE)
def self.pattern() TAGS_PATTERN end
end
@ -32,7 +32,7 @@ module Literal
class Math < AbstractLiteral
MATH_START = '(\${1,2}|' + Regexp.escape('\[') + '|\\begin\{equation\})'
MATH_END = '(\${1,2}|' + Regexp.escape('\]') + '|\\end\{equation\})'
MATH_PATTERN = Regexp.new(MATH_START + '([^$]|\\\$)+?' + MATH_END, Regexp::MULTILINE)
MATH_PATTERN = Regexp.new(MATH_START + '([^$]|\\\$)+' + MATH_END, Regexp::MULTILINE)
def self.pattern() MATH_PATTERN end
end

View file

@ -52,7 +52,7 @@ class UrlGenerator < AbstractUrlGenerator
case mode
when :export
if known_file
%{<a class="existingWikiWord" title="#{description}" href="#{CGI.escape(name)}.html">#{text}</a>}
%{<a class="existingWikiWord" title="#{description}" href="#{CGI.escape(name)}.#{@controller.html_ext}">#{text}</a>}
else
%{<span class="newWikiWord">#{text}</span>}
end
@ -79,7 +79,7 @@ class UrlGenerator < AbstractUrlGenerator
case mode
when :export
if known_page
%{<a class="existingWikiWord" href="#{CGI.escape(name)}.html">#{text}</a>}
%{<a class="existingWikiWord" href="#{CGI.escape(name)}.#{@controller.html_ext}">#{text}</a>}
else
%{<span class="newWikiWord">#{text}</span>}
end
@ -142,5 +142,5 @@ class UrlGenerator < AbstractUrlGenerator
%{<span class="deleteWikiWord">[[#{name}:delete]]</span>}
end
end
end