[ruby/rdoc] Create link to unary operator methods correctly

https://github.com/ruby/rdoc/commit/54500cf12a
This commit is contained in:
hyrious 2020-07-21 23:55:04 +09:00 committed by aycabta
parent 7693aa7056
commit 02951a45f0
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ class RDoc::CrossReference
# #
# See CLASS_REGEXP_STR # See CLASS_REGEXP_STR
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?' METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
## ##
# Regular expressions matching text that should potentially have # Regular expressions matching text that should potentially have

View File

@ -62,7 +62,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
name = name[1..-1] unless @show_hash if name[0, 1] == '#' name = name[1..-1] unless @show_hash if name[0, 1] == '#'
if name =~ /(.*[^#:])@/ if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
text ||= "#{CGI.unescape $'} at <code>#{$1}</code>" text ||= "#{CGI.unescape $'} at <code>#{$1}</code>"
code = false code = false
else else
@ -138,7 +138,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
# Creates an HTML link to +name+ with the given +text+. # Creates an HTML link to +name+ with the given +text+.
def link name, text, code = true def link name, text, code = true
if name =~ /(.*[^#:])@/ then if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
name = $1 name = $1
label = $' label = $'
end end