Class: Markbridge::Parsers::BBCode::Handlers::TableRowHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::TableRowHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/table_row_handler.rb
Overview
Handler for table row tags (tr)
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ TableRowHandler
constructor
A new instance of TableRowHandler.
- #on_close(token:, context:, registry:, tokens: nil) ⇒ Object
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize ⇒ TableRowHandler
Returns a new instance of TableRowHandler.
9 10 11 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_row_handler.rb', line 9 def initialize @element_class = AST::TableRow end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
30 31 32 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_row_handler.rb', line 30 def element_class @element_class end |
Instance Method Details
#on_close(token:, context:, registry:, tokens: nil) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_row_handler.rb', line 23 def on_close(token:, context:, registry:, tokens: nil) # Auto-close open cell before closing row context.pop if context.current.is_a?(AST::TableCell) super end |
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_row_handler.rb', line 13 def on_open(token:, context:, registry:, tokens: nil) # Auto-close open cell before starting new row context.pop if context.current.is_a?(AST::TableCell) # Auto-close previous row if still open context.pop if context.current.is_a?(AST::TableRow) element = AST::TableRow.new context.push(element, token:) end |