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

ruby-changes:67930

From: Nobuyoshi <ko1@a...>
Date: Sat, 11 Sep 2021 17:03:41 +0900 (JST)
Subject: [ruby-changes:67930] 6944163415 (master): [ruby/rdoc] Convert a backtick to an open single quote

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

From 6944163415997e75e0d70ea860dad6071ee5d79a Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 28 Aug 2021 12:57:36 +0900
Subject: [ruby/rdoc] Convert a backtick to an open single quote

https://github.com/ruby/rdoc/commit/82eaefbae4
---
 lib/rdoc/text.rb                      | 8 ++++++++
 test/rdoc/test_rdoc_markup_to_html.rb | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index 2fc47da..77318e4 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -240,6 +240,14 @@ module RDoc::Text https://github.com/ruby/ruby/blob/trunk/lib/rdoc/text.rb#L240
       when s.scan(/''/) then # tick double quote
         html << encoded[:close_dquote]
         after_word = nil
+      when s.scan(/`/) then # backtick
+        if insquotes or after_word
+          html << '`'
+          after_word = false
+        else
+          html << encoded[:open_squote]
+          insquotes = true
+        end
       when s.scan(/&#39;|'/) then # single quote
         if insquotes
           html << encoded[:close_squote]
diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb
index 342cf71..b2b21de 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -712,7 +712,7 @@ EXPECTED https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html.rb#L712
 
   def test_convert_underscore_adjacent_to_code
     assert_equal "\n<p><code>aaa</code>_</p>\n", @to.convert(%q{+aaa+_})
-    assert_equal "\n<p>`<code>i386-mswin32_</code><em>MSRTVERSION</em>&#39;</p>\n", @to.convert(%q{`+i386-mswin32_+_MSRTVERSION_'})
+    assert_equal "\n<p>\u{2018}<code>i386-mswin32_</code><em>MSRTVERSION</em>\u{2019}</p>\n", @to.convert(%q{`+i386-mswin32_+_MSRTVERSION_'})
   end
 
   def test_gen_url
-- 
cgit v1.1


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

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