diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index aabbb2038a..59ec698306 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -98,7 +98,10 @@ def handle_RDOCLINK(url) # :nodoc: gen_url CGI.escapeHTML(url), CGI.escapeHTML(text) when /^rdoc-image:/ - url, alt = $'.split(":", 2) # Split the string after "rdoc-image:" into url and alt + # Split the string after "rdoc-image:" into url and alt. + # "path/to/image.jpg:alt text" => ["path/to/image.jpg", "alt text"] + # "http://example.com/path/to/image.jpg:alt text" => ["http://example.com/path/to/image.jpg", "alt text"] + url, alt = $'.split(/:(?!\/)/, 2) if alt && !alt.empty? %[#{CGI.escapeHTML(alt)}] else diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index 26b9999ed0..e586e03cb9 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -749,6 +749,36 @@ def test_convert_TIDYLINK_image assert_not_include result, "