[前][次][番号順一覧][スレッド一覧]

ruby-changes:72735

From: Nobuyoshi <ko1@a...>
Date: Fri, 29 Jul 2022 09:21:48 +0900 (JST)
Subject: [ruby-changes:72735] f29f1d22c3 (master): [ruby/rdoc] Fix formatting blockquote in verbatim

https://git.ruby-lang.org/ruby.git/commit/?id=f29f1d22c3

From f29f1d22c3d62b72b8943eefb384cd7a52251ea1 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 29 Jul 2022 09:10:36 +0900
Subject: [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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/parser.rb#L287
         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 https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L812
     assert_equal expected, @m.convert(str, @to)
   end
 
+  def test_block_quote_in_verbatim
+    str = "BlockQuote\n  >>>\n"
+
+    expected = <<-EXPECTED
+<p>BlockQuote</p>
+<pre>&gt;&gt;&gt;</pre>
+    EXPECTED
+
+    assert_equal expected, @m.convert(str, @to).gsub(/^\n/, "")
+  end
+
   def test_parseable_eh
     valid_syntax = [
       'def x() end',
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]