class Mathml2latex::Converter

Public Class Methods

new() click to toggle source
# File lib/mathml2latex.rb, line 11
def initialize
  @service_object = Mathml2latex::MathmlLatexService.get_service_object
end

Public Instance Methods

replace_with_latex(xml_doc) click to toggle source
# File lib/mathml2latex.rb, line 19
    def replace_with_latex(xml_doc)
      nodes = xml_doc.xpath('//mm:math', 'mm' => Mathml2latex::MATHML_NAMESPACE)
      nodes.each do |node|
        node.replace(<<~XML)
          <latex xmlns="#{Mathml2latex::INSTUCTURE_LATEX_NS}">#{@service_object.to_latex(node.dup.to_xml)}</latex>
        XML
      end
    end
to_latex(mathml) click to toggle source
# File lib/mathml2latex.rb, line 15
def to_latex(mathml)
  @service_object.to_latex(mathml)
end