From 86384ac7f96a5f615b12116699c0ef08a0c86082 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 29 Jul 2022 09:10:36 +0900 Subject: [PATCH] Fix formatting blockquote in verbatim Reported at https://github.com/ruby/rdoc/pull/907#discussion_r932505816 --- 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 @@ def build_verbatim margin 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 @@ def test_list_verbatim_2 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',