mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
This commit is contained in:
parent
1a2490b564
commit
5397dd2e76
2 changed files with 5 additions and 2 deletions
|
@ -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]
|
||||
|
|
|
@ -145,6 +145,8 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue