File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -237,10 +237,18 @@ def to_html text
237237 when s . scan ( /``/ ) then # backtick double quote
238238 html << encoded [ :open_dquote ]
239239 after_word = nil
240- when s . scan ( /'' / ) then # tick double quote
240+ when s . scan ( /(?:'|'){2} / ) then # tick double quote
241241 html << encoded [ :close_dquote ]
242242 after_word = nil
243- when s . scan ( /'/ ) then # single quote
243+ when s . scan ( /`/ ) then # backtick
244+ if insquotes or after_word
245+ html << '`'
246+ after_word = false
247+ else
248+ html << encoded [ :open_squote ]
249+ insquotes = true
250+ end
251+ when s . scan ( /'|'/ ) then # single quote
244252 if insquotes
245253 html << encoded [ :close_squote ]
246254 insquotes = false
Original file line number Diff line number Diff line change @@ -712,7 +712,7 @@ def test_convert_with_exclude_tag
712712
713713 def test_convert_underscore_adjacent_to_code
714714 assert_equal "\n <p><code>aaa</code>_</p>\n " , @to . convert ( %q{+aaa+_} )
715- assert_equal "\n <p>` <code>i386-mswin32_</code><em>MSRTVERSION</em>' </p>\n " , @to . convert ( %q{`+i386-mswin32_+_MSRTVERSION_'} )
715+ assert_equal "\n <p>\u{2018} <code>i386-mswin32_</code><em>MSRTVERSION</em>\u{2019} </p>\n " , @to . convert ( %q{`+i386-mswin32_+_MSRTVERSION_'} )
716716 end
717717
718718 def test_gen_url
Original file line number Diff line number Diff line change @@ -485,6 +485,13 @@ def test_to_html_apostrophe
485485 assert_equal '‘a’ ‘' , to_html ( "'a' '" )
486486 end
487487
488+ def test_to_html_apostrophe_entity
489+ assert_equal '‘a' , to_html ( "'a" )
490+ assert_equal 'a’' , to_html ( "a'" )
491+
492+ assert_equal '‘a’ ‘' , to_html ( "'a' '" )
493+ end
494+
488495 def test_to_html_backslash
489496 assert_equal 'S' , to_html ( '\\S' )
490497 end
@@ -507,6 +514,7 @@ def test_to_html_dash
507514 def test_to_html_double_backtick
508515 assert_equal '“a' , to_html ( '``a' )
509516 assert_equal '“a“' , to_html ( '``a``' )
517+ assert_equal '“a”' , to_html ( "``a''" )
510518 end
511519
512520 def test_to_html_double_quote
You can’t perform that action at this time.
0 commit comments