From f29f1d22c3d62b72b8943eefb384cd7a52251ea1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 29 Jul 2022 09:10:36 +0900 Subject: [PATCH] [ruby/rdoc] Fix formatting blockquote in verbatim Reported at https://github.com/ruby/rdoc/pull/907#discussion_r932505816 https://github.com/ruby/rdoc/commit/86384ac7f9 --- lib/rdoc/markup/parser.rb | 2 ++ test/rdoc/test_rdoc_markup_to_html.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index 1b54a519d1..b0fcb61f50 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -287,6 +287,8 @@ class RDoc::Markup::Parser line << ' ' * indent when :BREAK, :TEXT then line << data + when :BLOCKQUOTE then + line << '>>>' else # *LIST_TOKENS list_marker = case type when :BULLET then data diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index e5d7a35710..3cf42d7c5e 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -812,6 +812,17 @@ EXPECTED assert_equal expected, @m.convert(str, @to) end + def test_block_quote_in_verbatim + str = "BlockQuote\n >>>\n" + + expected = <<-EXPECTED +

BlockQuote

+
>>>
+ EXPECTED + + assert_equal expected, @m.convert(str, @to).gsub(/^\n/, "") + end + def test_parseable_eh valid_syntax = [ 'def x() end',