ruby-changes:62345
From: hyrious <ko1@a...>
Date: Wed, 22 Jul 2020 02:42:22 +0900 (JST)
Subject: [ruby-changes:62345] 02951a45f0 (master): [ruby/rdoc] Create link to unary operator methods correctly
https://git.ruby-lang.org/ruby.git/commit/?id=02951a45f0 From 02951a45f0684b647499a214870a39acf1b6f422 Mon Sep 17 00:00:00 2001 From: hyrious <hyrious@o...> Date: Tue, 21 Jul 2020 23:55:04 +0900 Subject: [ruby/rdoc] Create link to unary operator methods correctly https://github.com/ruby/rdoc/commit/54500cf12a diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index 07ba14c..2785852 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -19,7 +19,7 @@ class RDoc::CrossReference https://github.com/ruby/ruby/blob/trunk/lib/rdoc/cross_reference.rb#L19 # # 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 diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 77e3a94..a9fd09d 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -62,7 +62,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L62 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>" code = false else @@ -138,7 +138,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L138 # Creates an HTML link to +name+ with the given +text+. def link name, text, code = true - if name =~ /(.*[^#:])@/ then + if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/ name = $1 label = $' end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/