Class: ChupaText::Decomposers::OpenDocumentPresentation::SlidesListener
- Inherits:
-
SAXListener
- Object
- SAXListener
- ChupaText::Decomposers::OpenDocumentPresentation::SlidesListener
- Defined in:
- lib/chupa-text/decomposers/opendocument-presentation.rb
Constant Summary collapse
- TEXT_URI =
"urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- DRAW_URI =
"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
Instance Method Summary collapse
- #cdata(content) ⇒ Object
- #characters(text) ⇒ Object
- #end_element(uri, local_name, qname) ⇒ Object
-
#initialize(slides) ⇒ SlidesListener
constructor
A new instance of SlidesListener.
- #start_element(uri, local_name, qname, attributes) ⇒ Object
Constructor Details
#initialize(slides) ⇒ SlidesListener
Returns a new instance of SlidesListener.
60 61 62 63 |
# File 'lib/chupa-text/decomposers/opendocument-presentation.rb', line 60 def initialize() @slides = @in_p = false end |
Instance Method Details
#cdata(content) ⇒ Object
95 96 97 |
# File 'lib/chupa-text/decomposers/opendocument-presentation.rb', line 95 def cdata(content) add_text(content) end |
#characters(text) ⇒ Object
91 92 93 |
# File 'lib/chupa-text/decomposers/opendocument-presentation.rb', line 91 def characters(text) add_text(text) end |
#end_element(uri, local_name, qname) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/chupa-text/decomposers/opendocument-presentation.rb', line 80 def end_element(uri, local_name, qname) @in_p = false case uri when TEXT_URI case local_name when "p" @slides.last[:text] << "\n" end end end |
#start_element(uri, local_name, qname, attributes) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/chupa-text/decomposers/opendocument-presentation.rb', line 65 def start_element(uri, local_name, qname, attributes) case uri when TEXT_URI case local_name when "p" @in_p = true end when DRAW_URI case local_name when "page" @slides << {text: +""} end end end |