def close_cell(eol = false)
cell_text = @buffer.strip
@buffer = ''
if format == 'psv'
cell_spec = take_cell_spec
if cell_spec.nil?
puts 'asciidoctor: ERROR: table missing leading separator, recovering automatically'
cell_spec = {}
repeat = 1
else
repeat = cell_spec.fetch('repeatcol', 1)
cell_spec.delete('repeatcol')
end
else
cell_spec = nil
repeat = 1
if format == 'csv'
if !cell_text.empty? && cell_text.include?('"')
if cell_text.start_with?('"') && cell_text.end_with?('"')
cell_text = cell_text[1..-2].strip
end
cell_text = cell_text.tr_s('"', '"')
end
end
end
1.upto(repeat) {|i|
if @col_count == -1
@table.columns << Table::Column.new(@table, @current_row.size + i - 1)
column = @table.columns.last
else
column = @table.columns[@current_row.size]
end
cell = Table::Cell.new(column, cell_text, cell_spec)
unless cell.rowspan.nil? || cell.rowspan == 1
activate_rowspan(cell.rowspan, (cell.colspan || 1))
end
@col_visits += (cell.colspan || 1)
@current_row << cell
close_row if end_of_row? && (@col_count != -1 || @linenum > 0 || (eol && i == repeat))
}
@open_cell = false
nil
end