From 09002bdab55da42aabdc3a7e0c079e29b7d23e8a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 28 Aug 2021 12:19:26 +0900 Subject: [PATCH] Convert single quotes in character entity references As well as double quotes. https://github.com/ruby/rdoc/pull/824#discussion_r683173389 --- lib/rdoc/text.rb | 2 +- test/rdoc/test_rdoc_text.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index c3218fdb2f..2fc47daa66 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -240,7 +240,7 @@ def to_html text when s.scan(/''/) then # tick double quote html << encoded[:close_dquote] after_word = nil - when s.scan(/'/) then # single quote + when s.scan(/'|'/) then # single quote if insquotes html << encoded[:close_squote] insquotes = false diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb index 59d63b29bd..02c56a2829 100644 --- a/test/rdoc/test_rdoc_text.rb +++ b/test/rdoc/test_rdoc_text.rb @@ -485,6 +485,13 @@ def test_to_html_apostrophe assert_equal '‘a’ ‘', to_html("'a' '") end + def test_to_html_apostrophe_entity + assert_equal '‘a', to_html("'a") + assert_equal 'a’', to_html("a'") + + assert_equal '‘a’ ‘', to_html("'a' '") + end + def test_to_html_backslash assert_equal 'S', to_html('\\S') end