diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 2bfabc8942..61f14d3ab7 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -324,7 +324,7 @@ def accept_table header, body, aligns header.zip(aligns) do |text, align| @res << '' << CGI.escapeHTML(text) << "\n" + @res << '>' << to_html(text) << "\n" end @res << "\n\n\n" body.each do |row| @@ -332,7 +332,7 @@ def accept_table header, body, aligns row.zip(aligns) do |text, align| @res << '' << CGI.escapeHTML(text) << "\n" + @res << '>' << to_html(text) << "\n" end @res << "\n" end diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index a5927dccae..02baf13512 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -876,5 +876,32 @@ def util_format text @to.end_accepting end + def test_accept_table + header = %w[Col1 Col2 Col3] + body = [ + %w[cell1_1 cell1_2 cell1_3], + %w[cell2_1 cell2_2 cell2_3], + ['',], + %w[+code+ _em_ **strong**], + ] + aligns = [:left, :right, nil] + @to.start_accepting + @to.accept_table(header, body, aligns) + res = @to.end_accepting + assert_include(res[%r<]*>Col1>], 'align="left"') + assert_include(res[%r<]*>Col2>], 'align="right"') + assert_not_include(res[%r<]*>Col3>], 'align=') + assert_include(res[%r<]*>cell1_1>], 'align="left"') + assert_include(res[%r<]*>cell1_2>], 'align="right"') + assert_not_include(res[%r<]*>cell1_3>], 'align=') + assert_include(res[%r<]*>cell2_1>], 'align="left"') + assert_include(res[%r<]*>cell2_2>], 'align="right"') + assert_not_include(res[%r<]*>cell2_3>], 'align=') + assert_not_include(res, '