ruby-changes:73871
From: Nobuyoshi <ko1@a...>
Date: Thu, 6 Oct 2022 18:24:57 +0900 (JST)
Subject: [ruby-changes:73871] 75a53f6be0 (master): [ruby/rdoc] Allow RDoc markups in table cells
https://git.ruby-lang.org/ruby.git/commit/?id=75a53f6be0 From 75a53f6be0bdd02fcf70a352892e085a02995cf9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 6 Oct 2022 12:05:26 +0900 Subject: [ruby/rdoc] Allow RDoc markups in table cells https://github.com/ruby/rdoc/commit/b16d3f1727 --- lib/rdoc/markup/to_html.rb | 4 ++-- test/rdoc/test_rdoc_markup_to_html.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) 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 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L324 header.zip(aligns) do |text, align| @res << '<th' @res << ' align="' << align << '"' if align - @res << '>' << CGI.escapeHTML(text) << "</th>\n" + @res << '>' << to_html(text) << "</th>\n" end @res << "</tr>\n</thead>\n<tbody>\n" body.each do |row| @@ -332,7 +332,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L332 row.zip(aligns) do |text, align| @res << '<td' @res << ' align="' << align << '"' if align - @res << '>' << CGI.escapeHTML(text) << "</td>\n" + @res << '>' << to_html(text) << "</td>\n" end @res << "</tr>\n" end diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index 8a053575d2..02baf13512 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -882,6 +882,7 @@ EXPECTED https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L882 %w[cell1_1 cell1_2 cell1_3], %w[cell2_1 cell2_2 cell2_3], ['<script>alert("foo");</script>',], + %w[+code+ _em_ **strong**], ] aligns = [:left, :right, nil] @to.start_accepting @@ -898,6 +899,9 @@ EXPECTED https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L899 assert_not_include(res[%r<<td[^<>]*>cell2_3</td>>], 'align=') assert_not_include(res, '<script>') assert_include(res[%r<<td[^<>]*>.*script.*</td>>], '<script>') + assert_include(res[%r<<td[^<>]*>.*code.*</td>>], '<code>code</code>') + assert_include(res[%r<<td[^<>]*>.*em.*</td>>], '<em>em</em>') + assert_include(res[%r<<td[^<>]*>.*strong.*</td>>], '<strong>strong</strong>') end end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/