[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
@ -150,9 +150,10 @@ class RDoc::Markup::AttributeManager
|
|||||||
exclusive == exclusive?(bitmap)
|
exclusive == exclusive?(bitmap)
|
||||||
}.keys
|
}.keys
|
||||||
return if tags.empty?
|
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|
|
1 while str.gsub!(re) { |orig|
|
||||||
attr = @matching_word_pairs[$2]
|
attr = @matching_word_pairs[$2]
|
||||||
|
@ -145,6 +145,8 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
|||||||
|
|
||||||
assert_equal(["cat and ", @em_on, "5", @em_off, " dogs"],
|
assert_equal(["cat and ", @em_on, "5", @em_off, " dogs"],
|
||||||
@am.flow("cat and _5_ dogs"))
|
@am.flow("cat and _5_ dogs"))
|
||||||
|
|
||||||
|
assert_equal([@tt_on, "__id__", @tt_off], @am.flow("+__id__+"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_bold
|
def test_bold
|
||||||
|
Loading…
x
Reference in New Issue
Block a user