summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-10 08:13:57 +0900
committergit <svn-admin@ruby-lang.org>2022-04-14 12:51:30 +0900
commite06100d969c7f6a275e121cb1154d3947d1ebe32 (patch)
tree6e8530e994761b7c5edaeb0e41235adcaa7b3bf1 /lib
parent5d45afdbbf058d82ced0b12bf9e4b2978db9f4e0 (diff)
[ruby/rdoc] Allow cross references to methods including underscores
As underscores are masked to "protect" from the conversion, consider also `PROTECT_ATTR` as a word character. https://github.com/ruby/rdoc/commit/db58bb5170
Diffstat (limited to 'lib')
-rw-r--r--lib/rdoc/cross_reference.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 0f301dcbb3..319bbc02ac 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -1,4 +1,7 @@
# frozen_string_literal: true
+
+require_relative 'markup/attribute_manager' # for PROTECT_ATTR
+
##
# RDoc::CrossReference is a reusable way to create cross references for names.
@@ -29,7 +32,10 @@ class RDoc::CrossReference
#
# See CLASS_REGEXP_STR
- METHOD_REGEXP_STR = /([A-Za-z]\w*[!?=]?|%|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%`|&^~])#{METHOD_ARGS_REGEXP_STR}/.source
+ METHOD_REGEXP_STR = /(
+ (?!\d)[\w#{RDoc::Markup::AttributeManager::PROTECT_ATTR}]+[!?=]?|
+ %|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%\`|&^~]
+ )#{METHOD_ARGS_REGEXP_STR}/.source.delete("\n ").freeze
##
# Regular expressions matching text that should potentially have