Class: Kwartz::TextConverter
- Defined in:
- lib/kwartz/converter.rb
Overview
convert presentation data (html) into a list of Statement. notice that TextConverter class hanlde html file as text format, not html format.
Instance Attribute Summary collapse
-
#linenum ⇒ Object
readonly
Returns the value of attribute linenum.
-
#rest ⇒ Object
readonly
Returns the value of attribute rest.
Attributes inherited from Converter
Instance Method Summary collapse
- #convert(input, filename = '') ⇒ Object
-
#initialize(handler, properties = {}) ⇒ TextConverter
constructor
A new instance of TextConverter.
Methods inherited from Converter
Methods included from ConvertErrorHelper
Constructor Details
#initialize(handler, properties = {}) ⇒ TextConverter
Returns a new instance of TextConverter.
984 985 986 987 |
# File 'lib/kwartz/converter.rb', line 984 def initialize(handler, properties={}) super @dattr = properties.fetch(:dattr, Config::PROPERTY_DATTR) # default: 'kw:d' end |
Instance Attribute Details
#linenum ⇒ Object (readonly)
Returns the value of attribute linenum.
1002 1003 1004 |
# File 'lib/kwartz/converter.rb', line 1002 def linenum @linenum end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
1002 1003 1004 |
# File 'lib/kwartz/converter.rb', line 1002 def rest @rest end |
Instance Method Details
#convert(input, filename = '') ⇒ Object
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'lib/kwartz/converter.rb', line 1005 def convert(input, filename='') reset(input, filename) stmt_list = [] _convert(stmt_list) ruleset = @handler.get_ruleset('#DOCUMENT') if ruleset stmt_list2 = [] elem_info = nil r = ruleset @handler.(r.before, stmt_list2, elem_info) if r.before if r.logic @handler.(r.logic, stmt_list2, elem_info) else stmt_list2.concat(stmt_list) end @handler.(r.after, stmt_list2, elem_info) if r.after stmt_list = stmt_list2 end return stmt_list end |