ruby-changes:71730
From: Nobuyoshi <ko1@a...>
Date: Thu, 14 Apr 2022 16:37:24 +0900 (JST)
Subject: [ruby-changes:71730] 5397dd2e76 (master): [ruby/rdoc] Apply matching word pairs to underscore-methods
https://git.ruby-lang.org/ruby.git/commit/?id=5397dd2e76 From 5397dd2e76952c5afc0d838f1d0bd53bcb0c5258 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> 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 +++-- test/rdoc/test_rdoc_markup_attribute_manager.rb | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/attribute_manager.rb#L150 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] diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb index 944364ba89..e8ff602f96 100644 --- a/test/rdoc/test_rdoc_markup_attribute_manager.rb +++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb @@ -145,6 +145,8 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb#L145 assert_equal(["cat and ", @em_on, "5", @em_off, " dogs"], @am.flow("cat and _5_ dogs")) + + assert_equal([@tt_on, "__id__", @tt_off], @am.flow("+__id__+")) end def test_bold -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/