Class: PnoteClient::Documents::Hml::Equation

Inherits:
Object
  • Object
show all
Defined in:
lib/pnote_client/documents/hml/equation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#scriptObject (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

#contentObject



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