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 StatementHelper
#add_foreach_stmts, #add_native_code, #add_native_expr_with_default, #build_print_args, #build_print_expr_stmt, #build_print_stmt, #create_text_print_stmt, #etag_stmt, #stag_stmt, #wrap_content_with_native_stmt, #wrap_element_with_native_stmt
Methods included from ConverterHelper
#_last_stmt_kind, #convert_error, #error_if_empty_tag, #error_when_last_stmt_is_not_if, #include_properties
Constructor Details
#initialize(handler, properties = {}) ⇒ TextConverter
Returns a new instance of TextConverter.
854 855 856 857 |
# File 'lib/kwartz/converter.rb', line 854 def initialize(handler, properties={}) super include_properties(properties) # set @delspan and @dattr end |
Instance Attribute Details
#linenum ⇒ Object (readonly)
Returns the value of attribute linenum.
871 872 873 |
# File 'lib/kwartz/converter.rb', line 871 def linenum @linenum end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
871 872 873 |
# File 'lib/kwartz/converter.rb', line 871 def rest @rest end |
Instance Method Details
#convert(input, filename = '') ⇒ Object
874 875 876 877 878 879 880 881 882 883 884 |
# File 'lib/kwartz/converter.rb', line 874 def convert(input, filename='') reset(input, filename) stmt_list = [] doc_ruleset = @handler.get_element_ruleset('DOCUMENT') stmt_list += doc_ruleset.begin if doc_ruleset && doc_ruleset.begin #stmt_list << NativeStatement.new(doc_ruleset.head.chomp, nil) if doc_ruleset && doc_ruleset.head _convert(stmt_list) stmt_list += doc_ruleset.end if doc_ruleset && doc_ruleset.end #stmt_list << NativeStatement.new(doc_ruleset.tail.chomp, nil) if doc_ruleset && doc_ruleset.tail return stmt_list end |