Class: ChupaText::Decomposers::OfficeOpenXML::TextListener
- Inherits:
-
SAXListener
- Object
- SAXListener
- ChupaText::Decomposers::OfficeOpenXML::TextListener
- Defined in:
- lib/chupa-text/decomposers/office-open-xml.rb
Instance Method Summary collapse
-
#cdata(content) ⇒ Object
-
#characters(text) ⇒ Object
-
#end_element(uri, local_name, qname) ⇒ Object
-
#initialize(output, target_uri) ⇒ TextListener
constructor
A new instance of TextListener.
-
#start_element(uri, local_name, qname, attributes) ⇒ Object
Constructor Details
#initialize(output, target_uri) ⇒ TextListener
Returns a new instance of TextListener.
78 79 80 81 82 |
# File 'lib/chupa-text/decomposers/office-open-xml.rb', line 78 def initialize(output, target_uri) @output = output @target_uri = target_uri @in_target = false end |
Instance Method Details
#cdata(content) ⇒ Object
106 107 108 |
# File 'lib/chupa-text/decomposers/office-open-xml.rb', line 106 def cdata(content) add_text(content) end |
#characters(text) ⇒ Object
102 103 104 |
# File 'lib/chupa-text/decomposers/office-open-xml.rb', line 102 def characters(text) add_text(text) end |
#end_element(uri, local_name, qname) ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/chupa-text/decomposers/office-open-xml.rb', line 92 def end_element(uri, local_name, qname) @in_target = false return unless uri == @target_uri case local_name when "p", "br" @output << "\n" end end |
#start_element(uri, local_name, qname, attributes) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/chupa-text/decomposers/office-open-xml.rb', line 84 def start_element(uri, local_name, qname, attributes) return unless uri == @target_uri case local_name when "t" @in_target = true end end |