From b80995dbdc54964e5beef624bb19be3b539a6f88 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sat, 24 Jan 2009 11:40:53 -0600 Subject: [PATCH] Equation Numbering in Maruku+itex2MML This was spooged by Revision #263 (to accommodate) BlahTeX/PNG support. Hopefully this way will work in both modes. --- .../maruku/lib/maruku/ext/math/to_html.rb | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/vendor/plugins/maruku/lib/maruku/ext/math/to_html.rb b/vendor/plugins/maruku/lib/maruku/ext/math/to_html.rb index 9bf9d500..7baba2bd 100644 --- a/vendor/plugins/maruku/lib/maruku/ext/math/to_html.rb +++ b/vendor/plugins/maruku/lib/maruku/ext/math/to_html.rb @@ -122,6 +122,14 @@ module MaRuKu; module Out; module HTML div = create_html_element 'div' add_class_to(div, 'maruku-equation') 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') div << mathml end @@ -130,6 +138,14 @@ module MaRuKu; module Out; module HTML img = adjust_png(png, use_depth=false) add_class_to(img, 'maruku-png') 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 source_span = Element.new 'span' @@ -139,14 +155,6 @@ module MaRuKu; module Out; module HTML 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