Tweak from Ari Stern

Match Maruku Revision 184: change wrapper for embedded TeX in display equation from
a <div> to a <span>.
This commit is contained in:
Jacques Distler 2008-10-23 22:44:53 -05:00
parent 0fdb13b257
commit e48b000c11
2 changed files with 18 additions and 19 deletions

View file

@ -80,8 +80,8 @@ class PageRendererTest < Test::Unit::TestCase
%{<div class='maruku-equation'><math class='maruku-mathml' display='block' } +
%{xmlns='http://www.w3.org/1998/Math/MathML'><mi>sin</mi><mo stretchy='false'>} +
%{(</mo><mi>x</mi><mo stretchy='false'>)</mo><semantics><annotation-xml encoding='SVG1.1'>} +
%{<svg/></annotation-xml></semantics></math><div class='maruku-eq-tex'><code style='display: none;'>} +
%{\\sin(x) \\begin{svg}<svg/>\\end{svg}</code></div></div>},
%{<svg/></annotation-xml></semantics></math><span class='maruku-eq-tex'><code style='display: none;'>} +
%{\\sin(x) \\begin{svg}<svg/>\\end{svg}</code></span></div>},
"$$\\sin(x) \\begin{svg}<svg/>\\end{svg}$$")
code_block = [
@ -115,7 +115,7 @@ class PageRendererTest < Test::Unit::TestCase
%{<p>ecuasi\303\263n</p>\n<div class='maruku-equation'><math class='maruku-mathml' } +
%{display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>sin</mi>} +
%{<mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo></math>} +
%{<div class='maruku-eq-tex'><code style='display: none;'>\\sin(x)</code></div></div>},
%{<span class='maruku-eq-tex'><code style='display: none;'>\\sin(x)</code></span></div>},
"ecuasi\303\263n\n$$\\sin(x)$$")
assert_markup_parsed_as(

View file

@ -104,7 +104,6 @@ module MaRuKu; module Out; module HTML
if mathml
add_class_to(mathml, 'maruku-mathml')
return mathml
# span << mathml
end
if png
@ -122,15 +121,6 @@ module MaRuKu; module Out; module HTML
div = create_html_element 'div'
add_class_to(div, 'maruku-equation')
if self.label # then numerate
span = Element.new 'span'
span.attributes['class'] = 'maruku-eq-number'
num = self.num
span << Text.new("(#{num})")
div << span
div.attributes['id'] = "eq:#{self.label}"
end
if mathml
add_class_to(mathml, 'maruku-mathml')
div << mathml
@ -142,12 +132,21 @@ module MaRuKu; module Out; module HTML
div << img
end
source_div = Element.new 'div'
add_class_to(source_div, 'maruku-eq-tex')
source_span = Element.new 'span'
add_class_to(source_span, 'maruku-eq-tex')
code = convert_to_mathml_none(:equation, self.math.strip)
code.attributes['style'] = 'display: none'
source_div << code
div << source_div
source_span << code
div << source_span
if self.label # then numerate
span = Element.new 'span'
span.attributes['class'] = 'maruku-eq-number'
num = self.num
span << Text.new("(#{num})")
div << span
div.attributes['id'] = "eq:#{self.label}"
end
div
end