lib/isodoc/presentation_function/math.rb in isodoc-2.12.0 vs lib/isodoc/presentation_function/math.rb in isodoc-2.12.1
- old
+ new
@@ -5,11 +5,10 @@
module IsoDoc
class PresentationXMLConvert < ::IsoDoc::Convert
MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
def mathml(docxml)
- docxml.xpath("//m:math", MATHML).each { |f| mathml_linebreak(f) }
locale = @lang.to_sym
@numfmt = Plurimath::NumberFormatter
.new(locale, localize_number: @localizenumber,
localizer_symbols: twitter_cldr_localiser_symbols)
docxml.xpath("//m:math", MATHML).each do |f| # rubocop:disable Style/CombinableLoops
@@ -156,22 +155,9 @@
end
def mathml1(node, locale)
mathml_style_inherit(node)
mathml_number(node, locale)
- end
-
- def mathml_linebreak(node)
- node.at(".//*/@linebreak") or return
- m = Plurimath::Math.parse(node.to_xml, :mathml)
- .to_mathml(split_on_linebreak: true)
- ret = Nokogiri::XML("<m>#{m}</m>").root
- ret.elements.each_with_index do |e, i|
- i.zero? or e.previous = "<br/>"
- end
- node.replace(<<~OUTPUT)
- <math-with-linebreak>#{ret.children}</math-with-linebreak><math-no-linebreak>#{node.to_xml}</math-no-linebreak>
- OUTPUT
end
# convert any Ascii superscripts to correct(ish) MathML
# Not bothering to match times, base of 1.0 x 10^-20, just ^-20
def mn_to_msup(node)