Skip to content

Commit 54500cf

Browse files
hyriousaycabta
authored andcommitted
Create link to unary operator methods correctly
1 parent 7e08e58 commit 54500cf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/rdoc/cross_reference.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class RDoc::CrossReference
1919
#
2020
# See CLASS_REGEXP_STR
2121

22-
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
22+
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
2323

2424
##
2525
# Regular expressions matching text that should potentially have

lib/rdoc/markup/to_html_crossref.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def cross_reference name, text = nil, code = true
6262

6363
name = name[1..-1] unless @show_hash if name[0, 1] == '#'
6464

65-
if name =~ /(.*[^#:])@/
65+
if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
6666
text ||= "#{CGI.unescape $'} at <code>#{$1}</code>"
6767
code = false
6868
else
@@ -138,7 +138,7 @@ def gen_url url, text
138138
# Creates an HTML link to +name+ with the given +text+.
139139

140140
def link name, text, code = true
141-
if name =~ /(.*[^#:])@/ then
141+
if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
142142
name = $1
143143
label = $'
144144
end

0 commit comments

Comments
 (0)