Class: Markbridge::AST::Table

Inherits:
Element show all
Defined in:
lib/markbridge/ast/table.rb

Overview

Represents a table element containing rows.

Examples:

table = AST::Table.new
table << AST::TableRow.new

Instance Attribute Summary

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from Markbridge::AST::Element

Instance Method Details

#<<(child) ⇒ Object

HTML/BBCode parsers add a Text(“n”) child for the whitespace between ‘<table>` and `<tr>` (and equivalent BBCode). Drop those so the AST contains only TableRow children.



14
15
16
17
18
# File 'lib/markbridge/ast/table.rb', line 14

def <<(child)
  return self if child.instance_of?(Text) && child.text.strip.empty?

  super
end