Module: Prawn::Markup::Processor::Tables
- Included in:
- Prawn::Markup::Processor
- Defined in:
- lib/prawn/markup/processor/tables.rb
Class Method Summary collapse
Instance Method Summary collapse
- #end_table ⇒ Object
- #end_td ⇒ Object (also: #end_th)
- #start_img ⇒ Object
- #start_table ⇒ Object
- #start_td ⇒ Object
- #start_th ⇒ Object
- #start_tr ⇒ Object
Class Method Details
.prepended(base) ⇒ Object
4 5 6 |
# File 'lib/prawn/markup/processor/tables.rb', line 4 def self.prepended(base) base.known_elements.push('table', 'tr', 'td', 'th') end |
Instance Method Details
#end_table ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/prawn/markup/processor/tables.rb', line 17 def end_table data = table_stack.pop return if data.empty? || data.all?(&:empty?) if table_stack.empty? add_table(data) else current_cell.nodes << data end end |
#end_td ⇒ Object Also known as: end_th
40 41 42 |
# File 'lib/prawn/markup/processor/tables.rb', line 40 def end_td add_cell_text_node(current_cell) end |
#start_img ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/prawn/markup/processor/tables.rb', line 45 def start_img if current_table add_cell_image(current_cell) else super end end |
#start_table ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/prawn/markup/processor/tables.rb', line 8 def start_table if current_table add_cell_text_node(current_cell) else add_current_text end table_stack.push([]) end |
#start_td ⇒ Object
32 33 34 |
# File 'lib/prawn/markup/processor/tables.rb', line 32 def start_td current_table.last << Elements::Cell.new(width: style_properties['width']) end |
#start_th ⇒ Object
36 37 38 |
# File 'lib/prawn/markup/processor/tables.rb', line 36 def start_th current_table.last << Elements::Cell.new(width: style_properties['width'], header: true) end |
#start_tr ⇒ Object
28 29 30 |
# File 'lib/prawn/markup/processor/tables.rb', line 28 def start_tr current_table << [] end |