Class: ENML_utils
- Inherits:
-
Object
- Object
- ENML_utils
- Defined in:
- lib/enml-utils.rb
Instance Method Summary collapse
-
#initialize(text, resources = nil, static_dirs = {}, note_guid = "") ⇒ ENML_utils
constructor
A new instance of ENML_utils.
- #resource_files ⇒ Object
- #to_html(to_text = false) ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(text, resources = nil, static_dirs = {}, note_guid = "") ⇒ ENML_utils
Returns a new instance of ENML_utils.
163 164 165 166 167 168 169 |
# File 'lib/enml-utils.rb', line 163 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_files ⇒ Object
192 193 194 195 |
# File 'lib/enml-utils.rb', line 192 def resource_files to_html unless @parsed return @files end |
#to_html(to_text = false) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/enml-utils.rb', line 171 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_text ⇒ Object
188 189 190 |
# File 'lib/enml-utils.rb', line 188 def to_text return to_html(true) end |