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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script) ⇒ Equation

Returns a new instance of Equation.



14
15
16
17
# File 'lib/pnote_client/documents/hml/equation.rb', line 14

def initialize(script)
  @script = script
  @script_converter = ::HwpScriptToLatex::Converter.new
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



19
20
21
22
23
24
25
# File 'lib/pnote_client/documents/hml/equation.rb', line 19

def content
  if @script_converter
    return @script_converter.convert(@script, math_mode: true, display_mode: true)
  else
    return @script
  end
end

#textable?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/pnote_client/documents/hml/equation.rb', line 27

def textable?
  return true
end