From e06100d969c7f6a275e121cb1154d3947d1ebe32 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 10 Feb 2022 08:13:57 +0900 Subject: [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 --- lib/rdoc/cross_reference.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/rdoc/cross_reference.rb') 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 -- cgit v1.2.3