summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-08-28 12:57:36 +0900
committergit <svn-admin@ruby-lang.org>2021-09-11 17:03:33 +0900
commit6944163415997e75e0d70ea860dad6071ee5d79a (patch)
tree02309323bb420c0efc567cf218e3bee7442a4c46
parentc5c0f5c65262f621484c711229e8c4de0b58d9d9 (diff)
[ruby/rdoc] Convert a backtick to an open single quote
https://github.com/ruby/rdoc/commit/82eaefbae4
-rw-r--r--lib/rdoc/text.rb8
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb2
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index 2fc47daa66..77318e46e4 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -240,6 +240,14 @@ module RDoc::Text
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 342cf71082..b2b21de806 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -712,7 +712,7 @@ EXPECTED
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