Class: Markbridge::Parsers::HTML::Handlers::TableCellHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/markbridge/parsers/html/handlers/table_cell_handler.rb

Overview

Handler for table cell tags (<td>, <th>)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTableCellHandler

Returns a new instance of TableCellHandler.



9
10
11
# File 'lib/markbridge/parsers/html/handlers/table_cell_handler.rb', line 9

def initialize
  @element_class = AST::TableCell
end

Instance Attribute Details

#element_classObject (readonly)

Returns the value of attribute element_class.



19
20
21
# File 'lib/markbridge/parsers/html/handlers/table_cell_handler.rb', line 19

def element_class
  @element_class
end

Instance Method Details

#process(element:, parent:) ⇒ Object



13
14
15
16
17
# File 'lib/markbridge/parsers/html/handlers/table_cell_handler.rb', line 13

def process(element:, parent:)
  ast_element = AST::TableCell.new(header: element.name.downcase == "th")
  parent << ast_element
  ast_element
end