diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 7c2e91cecf..2bfabc8942 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -61,12 +61,14 @@ def initialize options, markup = nil # # These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling. + URL_CHARACTERS_REGEXP_STR = /[A-Za-z0-9\-._~:\/\?#\[\]@!$&'\(\)*+,;%=]/.source + ## # Adds regexp handlings. def init_regexp_handlings # external links - @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/, + @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)#{URL_CHARACTERS_REGEXP_STR}+\w/, :HYPERLINK) init_link_notation_regexp_handlings end diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index b2b21de806..e5d7a35710 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -707,6 +707,7 @@ def test_convert_TIDYLINK_irc def test_convert_with_exclude_tag assert_equal "\n

aaa[:symbol]

\n", @to.convert('+aaa+[:symbol]') assert_equal "\n

aaa[:symbol]

\n", @to.convert('+aaa[:symbol]+') + assert_equal "\n

https:-foobar

\n", @to.convert('https:-foobar') assert_equal "\n

aaa

\n", @to.convert('aaa[:symbol]') end