Module: Asciidoctor::PDF::Rhrev::TableCellChangeBarFlagging
- Defined in:
- lib/asciidoctor/rhrev/table_cell_change_bar_patch.rb
Overview
Flags the marked cells while the table is being built from
asciidoctor-pdf's cell data, before any cell object exists for a
plain cell. Prawn extends every document instance with its table
interface at construction, so the constructor is the reliable
hook; a module prepended on the converter never sees the table
call.
Instance Method Summary collapse
Instance Method Details
#initialize(data, document, options = {}, &block) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/asciidoctor/rhrev/table_cell_change_bar_patch.rb', line 72 def initialize data, document, = {}, &block node = document.instance_variable_get :@rhrev_table_cell_bar_node change_attr = document.instance_variable_get :@change_bar_attr if node && change_attr && data.is_a?(::Array) rows = node.rows (rows[:head] + rows[:body] + rows[:foot]).each_with_index do |row, r| row.each_with_index do |cell, c| next unless cell.respond_to?(:attributes) && cell.attributes && (cell.attributes.key? change_attr) next unless (cell_data = data[r] && data[r][c]).is_a?(::Hash) if (content = cell_data[:content]).is_a? ::Prawn::Table::Cell content.rhrev_marked = true else cell_data[:rhrev_marked] = true end end end end super end |