Class: PnoteClient::Documents::Hml::Equation
- Inherits:
-
Object
- Object
- PnoteClient::Documents::Hml::Equation
- Defined in:
- lib/pnote_client/documents/hml/equation.rb
Instance Attribute Summary collapse
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Class Method Summary collapse
-
.from_tag(eq_tag) ⇒ Object
Textable Element.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(script) ⇒ Equation
constructor
A new instance of Equation.
- #textable? ⇒ Boolean
Constructor Details
#initialize(script) ⇒ Equation
16 17 18 19 |
# File 'lib/pnote_client/documents/hml/equation.rb', line 16 def initialize(script) @script = script @script_converter = ::HwpScriptToLatex::Converter.new end |
Instance Attribute Details
#script ⇒ Object (readonly)
Returns the value of attribute script.
14 15 16 |
# File 'lib/pnote_client/documents/hml/equation.rb', line 14 def script @script end |
Class Method Details
.from_tag(eq_tag) ⇒ Object
Textable Element
9 10 11 12 |
# File 'lib/pnote_client/documents/hml/equation.rb', line 9 def self.from_tag(eq_tag) script = eq_tag.xpath("SCRIPT")[0].content return self.new(script) end |
Instance Method Details
#content ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/pnote_client/documents/hml/equation.rb', line 21 def content if @script_converter return @script_converter.convert(@script, math_mode: true, display_mode: true) else return @script end end |
#textable? ⇒ Boolean
29 30 31 |
# File 'lib/pnote_client/documents/hml/equation.rb', line 29 def textable? return true end |