summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup/to_html.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-04-10 01:58:09 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-05 11:34:33 +0900
commit7c8aa0a5d2bc3f079077d113b350a58d7b7c2b0d (patch)
tree0bed6d29e4bcfde19dad6dc9833f2ec6938f648f /lib/rdoc/markup/to_html.rb
parent46ab28d6c9a80e91f6f56e9f902e0eff8eb1207e (diff)
[ruby/rdoc] Allow a label in a link to another document text
https://github.com/ruby/rdoc/commit/85bb2d33bb
Diffstat (limited to 'lib/rdoc/markup/to_html.rb')
-rw-r--r--lib/rdoc/markup/to_html.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 8ae4dd4720..6a8ca8a2d7 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -357,8 +357,8 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
- if scheme != 'link' and /\.(?:rb|rdoc|md)\z/i =~ url
- url = url.sub(%r%\A([./]*)(.*)\z%) { "#$1#{$2.tr('.', '_')}.html" }
+ if scheme != 'link' and %r%\A([./]*+)(.*?\.)(rb|rdoc|md)(?=\z|#)%i =~ url
+ url = "#$1#{$2.tr('.', '_')}#$3.html#{$'}"
end
text = text.sub %r%^#{scheme}:/*%i, ''