Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2963. Implement Table::Cell.block? and Table::Column.block? #2964

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/asciidoctor/table.rb
Expand Up @@ -215,6 +215,10 @@ def assign_width col_pcwidth, width_base = nil, pf = 10000.0
end
col_pcwidth
end

def block?
false
end
end

# Public: Methods for managing the a cell in an AsciiDoc table.
Expand Down Expand Up @@ -364,6 +368,10 @@ def lineno
@source_location && @source_location.lineno
end

def block?
false
end

def to_s
"#{super.to_s} - [text: #@text, colspan: #{@colspan || 1}, rowspan: #{@rowspan || 1}, attributes: #@attributes]"
end
Expand Down
22 changes: 22 additions & 0 deletions test/api_test.rb
Expand Up @@ -1196,6 +1196,28 @@ def [](key)
assert_equal '', cell.text
end

test 'should not crash if block? is called on Table Cell' do
input = <<-EOS
|===
|a
|===
EOS
table = (document_from_string input).blocks[0]
cell = table.rows.body[0][0]
assert_equal false, cell.block?
end

test 'should not crash if block? is called on Table Column' do
input = <<-EOS
|===
|a
|===
EOS
table = (document_from_string input).blocks[0]
column = table.rows.body[0][0].column
assert_equal false, column.block?
end

test 'should set option on node when set_option is called' do
input = <<-EOS
. three
Expand Down