Equation Numbering in Maruku+itex2MML

This was spooged by Revision #263 (to accommodate) BlahTeX/PNG support.
Hopefully this way will work in both modes.
This commit is contained in:
Jacques Distler 2009-01-24 11:40:53 -06:00
parent 0b2a6935a2
commit b80995dbdc

View file

@ -122,6 +122,14 @@ module MaRuKu; module Out; module HTML
div = create_html_element 'div' div = create_html_element 'div'
add_class_to(div, 'maruku-equation') add_class_to(div, 'maruku-equation')
if mathml if mathml
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
add_class_to(mathml, 'maruku-mathml') add_class_to(mathml, 'maruku-mathml')
div << mathml div << mathml
end end
@ -130,6 +138,14 @@ module MaRuKu; module Out; module HTML
img = adjust_png(png, use_depth=false) img = adjust_png(png, use_depth=false)
add_class_to(img, 'maruku-png') add_class_to(img, 'maruku-png')
div << img div << img
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
end end
source_span = Element.new 'span' source_span = Element.new 'span'
@ -139,14 +155,6 @@ module MaRuKu; module Out; module HTML
source_span << code source_span << code
div << source_span 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 div
end end