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
permalink .xslt ⇒ Object
Returns the value of attribute xslt.
28 29 30 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 28 def xslt @xslt end |
Class Method Details
permalink .get_service_object ⇒ Object
rubocop:disable Naming/AccessorMethodName
11 12 13 14 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 11 def self.get_service_object # rubocop:disable Naming/AccessorMethodName setup_xslt new end |
Instance Method Details
permalink #to_latex(mathml) ⇒ Object
[View source]
21 22 23 24 25 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 21 def to_latex(mathml) doc = Nokogiri::XML(mathml) result = self.class.xslt.transform(doc) result.at_xpath('//text()').text end |
permalink #to_latex_from_file(mathml_file) ⇒ Object
[View source]
16 17 18 19 |
# File 'lib/mathml2latex/mathml_latex_service.rb', line 16 def to_latex_from_file(mathml_file) mathml = File.open(mathml_file) to_latex(mathml) end |