Skip to content

Commit b16d3f1

Browse files
committed
Allow RDoc markups in table cells
1 parent 0cb3df7 commit b16d3f1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/rdoc/markup/to_html.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ def accept_table header, body, aligns
324324
header.zip(aligns) do |text, align|
325325
@res << '<th'
326326
@res << ' align="' << align << '"' if align
327-
@res << '>' << CGI.escapeHTML(text) << "</th>\n"
327+
@res << '>' << to_html(text) << "</th>\n"
328328
end
329329
@res << "</tr>\n</thead>\n<tbody>\n"
330330
body.each do |row|
331331
@res << "<tr>\n"
332332
row.zip(aligns) do |text, align|
333333
@res << '<td'
334334
@res << ' align="' << align << '"' if align
335-
@res << '>' << CGI.escapeHTML(text) << "</td>\n"
335+
@res << '>' << to_html(text) << "</td>\n"
336336
end
337337
@res << "</tr>\n"
338338
end

test/rdoc/test_rdoc_markup_to_html.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ def test_accept_table
882882
%w[cell1_1 cell1_2 cell1_3],
883883
%w[cell2_1 cell2_2 cell2_3],
884884
['<script>alert("foo");</script>',],
885+
%w[+code+ _em_ **strong**],
885886
]
886887
aligns = [:left, :right, nil]
887888
@to.start_accepting
@@ -898,6 +899,9 @@ def test_accept_table
898899
assert_not_include(res[%r<<td[^<>]*>cell2_3</td>>], 'align=')
899900
assert_not_include(res, '<script>')
900901
assert_include(res[%r<<td[^<>]*>.*script.*</td>>], '&lt;script&gt;')
902+
assert_include(res[%r<<td[^<>]*>.*code.*</td>>], '<code>code</code>')
903+
assert_include(res[%r<<td[^<>]*>.*em.*</td>>], '<em>em</em>')
904+
assert_include(res[%r<<td[^<>]*>.*strong.*</td>>], '<strong>strong</strong>')
901905
end
902906
end
903907

0 commit comments

Comments
 (0)