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
6 7 8 |
# File 'lib/prawn/markup/processor/tables.rb', line 6 def self.prepended(base) base.known_elements.push('table', 'tr', 'td', 'th') end |
Instance Method Details
#end_table ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/prawn/markup/processor/tables.rb', line 19 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
48 49 50 51 52 53 54 |
# File 'lib/prawn/markup/processor/tables.rb', line 48 def end_td if current_table add_cell_text_node(current_cell) else add_current_text end end |
#start_img ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/prawn/markup/processor/tables.rb', line 57 def start_img if current_table add_cell_image(current_cell) else super end end |
#start_table ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/prawn/markup/processor/tables.rb', line 10 def start_table if current_table add_cell_text_node(current_cell) else add_current_text end table_stack.push([]) end |
#start_td ⇒ Object
36 37 38 39 40 |
# File 'lib/prawn/markup/processor/tables.rb', line 36 def start_td return unless current_table current_table.last << Elements::Cell.new(width: style_properties['width']) end |
#start_th ⇒ Object
42 43 44 45 46 |
# File 'lib/prawn/markup/processor/tables.rb', line 42 def start_th return unless current_table current_table.last << Elements::Cell.new(width: style_properties['width'], header: true) end |
#start_tr ⇒ Object
30 31 32 33 34 |
# File 'lib/prawn/markup/processor/tables.rb', line 30 def start_tr return unless current_table current_table << [] end |