lib/isodoc/presentation_function/math.rb in isodoc-1.7.3.1 vs lib/isodoc/presentation_function/math.rb in isodoc-1.7.4
- old
+ new
@@ -1,7 +1,8 @@
require "twitter_cldr"
require "bigdecimal"
+require "mathml2asciimath"
module IsoDoc
class PresentationXMLConvert < ::IsoDoc::Convert
MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
@@ -68,10 +69,18 @@
locale = TwitterCldr.supported_locale?(@lang.to_sym) ? @lang.to_sym : :en
twitter_cldr_reader(locale)
locale
end
+ def asciimath_dup(node)
+ return if @suppressasciimathdup
+
+ a = MathML2AsciiMath.m2a(node.to_xml)
+ node.next = "<!-- #{a} -->"
+ end
+
def mathml1(node, locale)
+ asciimath_dup(node)
localize_maths(node, locale)
return unless node.elements.size == 1 && node.elements.first.name == "mn"
if node.parent.name == "stem"
node.parent.replace(node.at("./m:mn", MATHML).children)