Class: HTOTConv::Parser::HtmlList::ListDoc
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- HTOTConv::Parser::HtmlList::ListDoc
- Defined in:
- lib/htot_conv/parser/html_list.rb
Instance Method Summary collapse
- #cdata_block(string) ⇒ Object
- #characters(string) ⇒ Object
- #end_element(name) ⇒ Object
-
#initialize(outline) ⇒ ListDoc
constructor
A new instance of ListDoc.
- #start_element(name, attrs = []) ⇒ Object
Constructor Details
#initialize(outline) ⇒ ListDoc
Returns a new instance of ListDoc.
29 30 31 32 33 |
# File 'lib/htot_conv/parser/html_list.rb', line 29 def initialize(outline) @outline = outline @breadcrumb = [] @li_text = nil end |
Instance Method Details
#cdata_block(string) ⇒ Object
57 58 59 |
# File 'lib/htot_conv/parser/html_list.rb', line 57 def cdata_block(string) @li_text << string unless @li_text.nil? end |
#characters(string) ⇒ Object
53 54 55 |
# File 'lib/htot_conv/parser/html_list.rb', line 53 def characters(string) @li_text << string unless @li_text.nil? end |
#end_element(name) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/htot_conv/parser/html_list.rb', line 44 def end_element(name) if ((name == "ul") || (name == "ol")) generate_outline_item unless @li_text.nil? @breadcrumb.pop elsif name == "li" generate_outline_item unless @li_text.nil? end end |
#start_element(name, attrs = []) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/htot_conv/parser/html_list.rb', line 35 def start_element(name, attrs=[]) if ((name == "ul") || (name == "ol")) generate_outline_item unless @li_text.nil? @breadcrumb << name elsif name == "li" @li_text = "".dup if @breadcrumb.length > 0 end end |