Class: ReverseAsciidoctor::Converters::Tr

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

Instance Method Summary collapse

Methods inherited from Base

#escape_keychars, #extract_title, #treat, #treat_children

Instance Method Details

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



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

def convert(node, state = {})
  content = treat_children(node, state).rstrip
  result  = "#{content}\n"
  table_header_row?(node) ? result + underline_for(node) : result
end

#table_header_row?(node) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#underline_for(node) ⇒ Object



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

def underline_for(node)
  "\n"
end