Class: Markbridge::Parsers::BBCode::Handlers::TableCellHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::TableCellHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/table_cell_handler.rb
Overview
Handler for table cell tags (td, th)
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ TableCellHandler
constructor
A new instance of TableCellHandler.
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize ⇒ TableCellHandler
Returns a new instance of TableCellHandler.
9 10 11 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_cell_handler.rb', line 9 def initialize @element_class = AST::TableCell end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
21 22 23 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_cell_handler.rb', line 21 def element_class @element_class end |
Instance Method Details
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/markbridge/parsers/bbcode/handlers/table_cell_handler.rb', line 13 def on_open(token:, context:, registry:, tokens: nil) # Auto-close previous cell if still open context.pop if context.current.is_a?(AST::TableCell) element = AST::TableCell.new(header: token.tag == "th") context.push(element, token:) end |