Method: IsoDoc::PresentationXMLConvert#localize_maths

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

#localize_maths(node, locale) ⇒ Object

symbols is merged into TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/isodoc/presentation_function/math.rb', line 23

def localize_maths(node, locale)
  node.xpath(".//m:mn", MATHML).each do |x|
    fmt = x["data-metanorma-numberformat"]
    x.delete("data-metanorma-numberformat")
    x.children =
      if !fmt.nil? && !fmt.empty?
        explicit_number_formatter(x, locale, fmt)
      else implicit_number_formatter(x, locale)
      end
  rescue ArgumentError
  rescue StandardError, RuntimeError => e
    warn "Failure to localise MathML/mn\n#{node.parent.to_xml}\n#{e}"
  end
end