Class: Coradoc::Input::Html::Converters::Tr

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/html/input/converters/tr.rb

Constant Summary collapse

INSTANCE =
new

Instance Method Summary collapse

Methods inherited from Base

#extract_leading_trailing_whitespace, #extract_text_from_content, #extract_title, #node_has_ancestor?, #textnode_after_start_with?, #textnode_before_end_with?, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?

Instance Method Details

#table_header_row?(node) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/coradoc/html/input/converters/tr.rb', line 20

def table_header_row?(node)
  node.previous_element.nil?
end

#to_coradoc(node, state = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/coradoc/html/input/converters/tr.rb', line 10

def to_coradoc(node, state = {})
  content = treat_children_coradoc(node, state)
  header = table_header_row?(node)
  # Use CoreModel::TableRow with cells (not columns)
  Coradoc::CoreModel::TableRow.new(
    cells: content,
    header: header
  )
end