Class: Coradoc::Mirror::ReverseBuilder::Table

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/mirror/reverse_builder.rb

Overview

── Tables ──

Instance Attribute Summary

Attributes inherited from Base

#context

Instance Method Summary collapse

Methods inherited from Base

#apply_mark, #build_content, #build_inline_children, #build_node, #extract_text, #initialize, #inline_content, registers

Constructor Details

This class inherits a constructor from Coradoc::Mirror::ReverseBuilder::Base

Instance Method Details

#build(node) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/coradoc/mirror/reverse_builder.rb', line 391

def build(node)
  rows = []
  node.content&.each do |child|
    next unless child.is_a?(Node)
    next unless %w[table_head table_body].include?(child.type)

    child.content&.each do |row_node|
      rows << build_node(row_node) if row_node.is_a?(Node)
    end
  end

  CoreModel::Table.new(title: node.attrs&.title, rows: rows)
end