Sha256: a24474780a615adcdfabbece5b19ce3a6232752a87b26666234af6ed282ffcea

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

require_relative "parse"
require_relative "constants"
require_relative "transform"
module Plurimath
  class Latex
    class Parser
      attr_accessor :text

      def initialize(text)
        @text = text.gsub(" ", "").gsub("\n", "")
      end

      def parse
        tree_t = Plurimath::Latex::Parse.new.parse(text)
        formula = Plurimath::Latex::Transform.new.apply(tree_t)
        formula = [formula] unless formula.is_a?(Array)

        Plurimath::Math::Formula.new(formula)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plurimath-0.2.0 lib/plurimath/latex/parser.rb