Class: HTML2AsciiMath::HTMLParser::SAXCallbacks
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- HTML2AsciiMath::HTMLParser::SAXCallbacks
- Defined in:
- lib/html2asciimath/html_parser.rb
Instance Attribute Summary collapse
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
- #characters(text) ⇒ Object
- #end_element(elem_name) ⇒ Object
-
#initialize(parser) ⇒ SAXCallbacks
constructor
A new instance of SAXCallbacks.
- #start_element(elem_name, _attrs = []) ⇒ Object
Constructor Details
#initialize(parser) ⇒ SAXCallbacks
Returns a new instance of SAXCallbacks.
62 63 64 |
# File 'lib/html2asciimath/html_parser.rb', line 62 def initialize(parser) @parser = parser end |
Instance Attribute Details
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
60 61 62 |
# File 'lib/html2asciimath/html_parser.rb', line 60 def parser @parser end |
Instance Method Details
#characters(text) ⇒ Object
66 67 68 69 |
# File 'lib/html2asciimath/html_parser.rb', line 66 def characters(text) HTMLTextParser.new(text, parser.converter).parse true end |
#end_element(elem_name) ⇒ Object
77 78 79 80 81 |
# File 'lib/html2asciimath/html_parser.rb', line 77 def end_element(elem_name) # TODO auto-close elements which are above this one in elements stack handler = ELEMENT_HANDLERS[elem_name] handler && parser.send(handler, false) end |
#start_element(elem_name, _attrs = []) ⇒ Object
71 72 73 74 75 |
# File 'lib/html2asciimath/html_parser.rb', line 71 def start_element(elem_name, _attrs = []) # TODO maintain some elements stack handler = ELEMENT_HANDLERS[elem_name] handler && parser.send(handler, true) end |