Skip to content

Commit

Permalink
[ruby/rdoc] Convert single quotes in character entity references
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Sep 11, 2021
1 parent 30b4da2 commit c5c0f5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rdoc/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(/&#39;|'/) then # single quote
if insquotes
html << encoded[:close_squote]
insquotes = false
Expand Down
7 changes: 7 additions & 0 deletions test/rdoc/test_rdoc_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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("&#39;a")
assert_equal 'a’', to_html("a&#39;")

assert_equal '‘a’ ‘', to_html("&#39;a&#39; &#39;")
end

def test_to_html_backslash
assert_equal 'S', to_html('\\S')
end
Expand Down

0 comments on commit c5c0f5c

Please sign in to comment.