From 5397dd2e76952c5afc0d838f1d0bd53bcb0c5258 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 14 Apr 2022 16:13:36 +0900 Subject: [ruby/rdoc] Apply matching word pairs to underscore-methods Protected characters with `PROTECT_ATTR` should not have special roles. https://github.com/ruby/rdoc/commit/c318af0ea2 --- lib/rdoc/markup/attribute_manager.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 6843e6c3d0..6ef5af8856 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -150,9 +150,10 @@ class RDoc::Markup::AttributeManager exclusive == exclusive?(bitmap) }.keys return if tags.empty? - all_tags = @matching_word_pairs.keys + tags = "[#{tags.join("")}](?!#{PROTECT_ATTR})" + all_tags = "[#{@matching_word_pairs.keys.join("")}](?!#{PROTECT_ATTR})" - re = /(^|\W|[#{all_tags.join("")}])([#{tags.join("")}])(\2*[#\\]?[\w:.\/\[\]-]+?\S?)\2(?!\2)([#{all_tags.join("")}]|\W|$)/ + re = /(^|\W|#{all_tags})(#{tags})(\2*[#\\]?[\w:#{PROTECT_ATTR}.\/\[\]-]+?\S?)\2(?!\2)(#{all_tags}|\W|$)/ 1 while str.gsub!(re) { |orig| attr = @matching_word_pairs[$2] -- cgit v1.2.3