Class: ENML_utils

Inherits:
Object
  • Object
show all
Defined in:
lib/enml-utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, resources = nil, static_dirs = {}, note_guid = "") ⇒ ENML_utils

Returns a new instance of ENML_utils.



162
163
164
165
166
167
168
# File 'lib/enml-utils.rb', line 162

def initialize(text, resources = nil, static_dirs = {}, note_guid = "")
  @text = text or ""
  @resources = resources or []
  @static_dirs = static_dirs
  @note_guid = note_guid
  @parsed = false
end

Instance Method Details

#resource_filesObject



191
192
193
194
# File 'lib/enml-utils.rb', line 191

def resource_files
  to_html unless @parsed
  return @files
end

#to_html(to_text = false) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/enml-utils.rb', line 170

def to_html(to_text=false)
  parser = Parsers::SAX2Parser.new( @text )
  debug "to_html input text:"
  debug "-----"
  debug @text
  debug "-----"
  listener = ENML_Listener.new(@resources, to_text, @static_dirs, @note_guid)
  parser.listen(listener)
  parser.parse
  @files = listener.files
  @parsed = true
  debug "to_html output:"
  debug listener.output
  debug "-----"
  return listener.output
end

#to_textObject



187
188
189
# File 'lib/enml-utils.rb', line 187

def to_text
  return to_html(true)
end