Skip to content

Commit

Permalink
resolves asciidoctor#1460 don't crash if colspan exceeds colspec
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Oct 10, 2015
1 parent 8a00d8b commit 8457a04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/asciidoctor/table.rb
Expand Up @@ -473,7 +473,7 @@ def close_cell(eol = false)
end
else
# QUESTION is this right for cells that span columns?
column = @table.columns[@current_row.size]
return unless (column = @table.columns[@current_row.size])
end

cell = Table::Cell.new(column, cell_text, cell_spec, @last_cursor)
Expand Down
16 changes: 16 additions & 0 deletions test/tables_test.rb
Expand Up @@ -579,6 +579,22 @@
assert_xpath '/table/tbody/tr[3]/td[3]/p[text()="c"]', output, 1
end

test 'ignores cell with colspan that exceeds colspec' do
input = <<-EOS
[cols="1,1"]
|===
3+|A
|B
a|C
more C
|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table *', output, 0
end

test 'paragraph, verse and literal content' do
input = <<-EOS
[cols=",^v,^l",options="header"]
Expand Down

0 comments on commit 8457a04

Please sign in to comment.