Method: IsoDoc::PresentationXMLConvert#mn_to_msup

Defined in:
lib/isodoc/presentation_function/math.rb

#mn_to_msup(node) ⇒ Object

convert any Ascii superscripts to correct(ish) MathML Not bothering to match times, base of 1.0 x 10^-20, just ^-20



175
176
177
178
179
180
# File 'lib/isodoc/presentation_function/math.rb', line 175

def mn_to_msup(node)
  node.xpath(".//m:mn", MATHML).each do |n|
    m = %r{^(.+)\^([0-9+-]+)$}.match(n.text) or next
    n.replace("<msup><mn>#{m[1]}</mn><mn>#{m[2]}</mn></msup>")
  end
end