Class: ReverseAdoc::Converters::Tr

Inherits:
Base
  • Object
show all
Defined in:
lib/reverse_adoc/converters/tr.rb

Instance Method Summary collapse

Methods inherited from Base

#constrained?, #escape_keychars, #extract_title, #node_has_ancestor?, #textnode_before_end_with?, #treat, #treat_children, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?

Instance Method Details

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



10
11
12
# File 'lib/reverse_adoc/converters/tr.rb', line 10

def convert(node, state = {})
  Coradoc::Generator.gen_adoc(to_coradoc(node, state))
end

#table_header_row?(node) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/reverse_adoc/converters/tr.rb', line 14

def table_header_row?(node)
  # node.element_children.all? {|child| child.name.to_sym == :th}
  node.previous_element.nil?
end

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



4
5
6
7
8
# File 'lib/reverse_adoc/converters/tr.rb', line 4

def to_coradoc(node, state = {})
  content = treat_children_coradoc(node, state)
  header = table_header_row?(node)
  Coradoc::Element::Table::Row.new(content, header)
end