Class | MathMLWrapper |
In: |
markup/simple_markup/mathml_wrapper.rb
|
Parent: | Object |
This class is MathML module wrapper. If MathML module can not be loaded, methods in this module return raw argument without modification.
# File markup/simple_markup/mathml_wrapper.rb, line 6 6: def initialize 7: @load_error_flag = false 8: begin 9: require "mathml" 10: rescue LoadError 11: @load_error_flag = true 12: end 13: end
# File markup/simple_markup/mathml_wrapper.rb, line 14 14: def parse(formula, block=false) 15: return formula if @load_error_flag 16: mathml_formula = MathML::LaTeX::Parser.new 17: begin 18: mathml_formula_str = mathml_formula.parse(formula, block).to_s 19: rescue MathML::LaTeX::ParseError 20: return formula, 1 21: end 22: return mathml_formula_str, 0 23: end