Skip to content

Commit 917fe41

Browse files
committed
Apply markup in table cell
1 parent f85cf5c commit 917fe41

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

lib/rdoc/markup/to_rdoc.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ def accept_verbatim(verbatim)
250250
# Adds +table+ to the output
251251

252252
def accept_table(header, body, aligns)
253+
body = body.map do |row|
254+
row.map do |cell|
255+
attributes cell
256+
end
257+
end
253258
widths = header.zip(*body).map do |cols|
254259
cols.map(&:size).max
255260
end

test/rdoc/markup/to_ansi_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ def list_verbatim
350350

351351
def accept_table_align
352352
expected = "\e[0m" + <<-EXPECTED
353-
AA |BB |CCCCC|DDDDD
354-
----|---|-----|-----
353+
AA |BB |CCCCC| DDDDD
354+
----|---|-----|---------
355355
|bbb| c|
356-
aaaa|b | | dd
357-
a | | cc| dd
356+
aaaa|b | | dd
357+
a | | cc|\e[7mdd\e[m
358358
EXPECTED
359359
assert_equal expected, @to.end_accepting
360360
end

test/rdoc/markup/to_markdown_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def accept_table_align
352352
----|---|-----|-----
353353
|bbb| c|
354354
aaaa|b | | dd
355-
a | | cc| dd
355+
a | | cc|`dd`
356356
EXPECTED
357357
assert_equal expected, @to.end_accepting
358358
end

test/rdoc/markup/to_rdoc_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ def list_verbatim
348348

349349
def accept_table_align
350350
expected = <<-EXPECTED
351-
AA |BB |CCCCC|DDDDD
352-
----|---|-----|-----
351+
AA |BB |CCCCC| DDDDD
352+
----|---|-----|-----------
353353
|bbb| c|
354-
aaaa|b | | dd
355-
a | | cc| dd
354+
aaaa|b | | dd
355+
a | | cc|<tt>dd</tt>
356356
EXPECTED
357357
assert_equal expected, @to.end_accepting
358358
end

test/rdoc/support/text_formatter_test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_accept_table_align
107107
body = [
108108
['', 'bbb', 'c', ''],
109109
['aaaa', 'b', '', 'dd'],
110-
['a', '', 'cc', 'dd']
110+
['a', '', 'cc', '<code>dd</code>']
111111
]
112112
aligns = [nil, :left, :right, :center]
113113
@to.start_accepting

0 commit comments

Comments
 (0)