Class: Markbridge::Parsers::HTML::Handlers::ListHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::HTML::Handlers::ListHandler
- Defined in:
- lib/markbridge/parsers/html/handlers/list_handler.rb
Overview
Handler for list tags (<ul>, <ol>)
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ ListHandler
constructor
A new instance of ListHandler.
- #process(element:, parent:) ⇒ Object
Constructor Details
#initialize ⇒ ListHandler
Returns a new instance of ListHandler.
9 10 11 |
# File 'lib/markbridge/parsers/html/handlers/list_handler.rb', line 9 def initialize @element_class = AST::List end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
24 25 26 |
# File 'lib/markbridge/parsers/html/handlers/list_handler.rb', line 24 def element_class @element_class end |
Instance Method Details
#process(element:, parent:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/markbridge/parsers/html/handlers/list_handler.rb', line 13 def process(element:, parent:) # Check if ordered: <ol> tag ordered = element.name.downcase == "ol" ast_element = AST::List.new(ordered:) parent << ast_element # Return element to signal: process children into this element ast_element end |