Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/rdoc/markup/to_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ def accept_verbatim(verbatim)
# Adds +table+ to the output

def accept_table(header, body, aligns)
body = body.map do |row|
row.map do |cell|
attributes cell
end
end
widths = header.zip(*body).map do |cols|
cols.map(&:size).max
end
Expand Down
8 changes: 4 additions & 4 deletions test/rdoc/markup/to_ansi_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ def list_verbatim

def accept_table_align
expected = "\e[0m" + <<-EXPECTED
AA |BB |CCCCC|DDDDD
----|---|-----|-----
AA |BB |CCCCC| DDDDD
----|---|-----|---------
|bbb| c|
aaaa|b | | dd
a | | cc| dd
aaaa|b | | dd
a | | cc|\e[7mdd\e[m
EXPECTED
assert_equal expected, @to.end_accepting
end
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/markup/to_markdown_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def accept_table_align
----|---|-----|-----
|bbb| c|
aaaa|b | | dd
a | | cc| dd
a | | cc|`dd`
EXPECTED
assert_equal expected, @to.end_accepting
end
Expand Down
8 changes: 4 additions & 4 deletions test/rdoc/markup/to_rdoc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ def list_verbatim

def accept_table_align
expected = <<-EXPECTED
AA |BB |CCCCC|DDDDD
----|---|-----|-----
AA |BB |CCCCC| DDDDD
----|---|-----|-----------
|bbb| c|
aaaa|b | | dd
a | | cc| dd
aaaa|b | | dd
a | | cc|<tt>dd</tt>
EXPECTED
assert_equal expected, @to.end_accepting
end
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/support/text_formatter_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_accept_table_align
body = [
['', 'bbb', 'c', ''],
['aaaa', 'b', '', 'dd'],
['a', '', 'cc', 'dd']
['a', '', 'cc', '<code>dd</code>']
]
aligns = [nil, :left, :right, :center]
@to.start_accepting
Expand Down