Sha256: a76aef85d314ff3000bf527b4408ce277b53df28169f6867c729c02fcd1c4a05

Contents?: true

Size: 520 Bytes

Versions: 10

Compression:

Stored size: 520 Bytes

Contents

module ReverseAsciidoctor
  module Converters
    class Tr < Base
      def convert(node, state = {})
        content = treat_children(node, state).rstrip
        result  = "#{content}\n"
        table_header_row?(node) ? result + underline_for(node) : result
      end

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

      def underline_for(node)
        "\n"
      end
    end

    register :tr, Tr.new
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
reverse_adoc-0.2.8 lib/reverse_asciidoctor/converters/tr.rb
reverse_adoc-0.2.7 lib/reverse_asciidoctor/converters/tr.rb
reverse_adoc-0.2.6 lib/reverse_asciidoctor/converters/tr.rb
reverse_adoc-0.2.5 lib/reverse_asciidoctor/converters/tr.rb
reverse_adoc-0.2.4 lib/reverse_asciidoctor/converters/tr.rb
reverse_adoc-0.2.3 lib/reverse_asciidoctor/converters/tr.rb
reverse_asciidoctor-0.2.2 lib/reverse_asciidoctor/converters/tr.rb
reverse_asciidoctor-0.2.1 lib/reverse_asciidoctor/converters/tr.rb
reverse_asciidoctor-0.2.0 lib/reverse_asciidoctor/converters/tr.rb
reverse_asciidoctor-0.1.0 lib/reverse_asciidoctor/converters/tr.rb