Class: Mathml2latex::MathmlLatexService
- Inherits:
-
Object
- Object
- Mathml2latex::MathmlLatexService
- Defined in:
- lib/mathml2latex/mathml_latex_service.rb
Class Attribute Summary collapse
-
.xslt ⇒ Object
Returns the value of attribute xslt.
Class Method Summary collapse
-
.get_service_object ⇒ Object
rubocop:disable Naming/AccessorMethodName.
Instance Method Summary collapse
Class Attribute Details
.xslt ⇒ Object
Returns the value of attribute xslt.
26 27 28 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 26 def xslt @xslt end |
Class Method Details
.get_service_object ⇒ Object
rubocop:disable Naming/AccessorMethodName
9 10 11 12 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 9 def self.get_service_object # rubocop:disable Naming/AccessorMethodName setup_xslt new end |
Instance Method Details
#to_latex(mathml) ⇒ Object
19 20 21 22 23 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 19 def to_latex(mathml) doc = Nokogiri::XML(mathml) result = self.class.xslt.transform(doc) result.at_xpath('//text()').text end |
#to_latex_from_file(mathml_file) ⇒ Object
14 15 16 17 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 14 def to_latex_from_file(mathml_file) mathml = File.open(mathml_file) to_latex(mathml) end |