Skip to content

Commit cee7e26

Browse files
authored
Merge pull request #880 from nobu/underscore-methods
Apply matching word pairs to underscore-methods
2 parents 573fa92 + c318af0 commit cee7e26

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/rdoc/markup/attribute_manager.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ def convert_attrs_matching_word_pairs(str, attrs, exclusive)
150150
exclusive == exclusive?(bitmap)
151151
}.keys
152152
return if tags.empty?
153-
all_tags = @matching_word_pairs.keys
153+
tags = "[#{tags.join("")}](?!#{PROTECT_ATTR})"
154+
all_tags = "[#{@matching_word_pairs.keys.join("")}](?!#{PROTECT_ATTR})"
154155

155-
re = /(^|\W|[#{all_tags.join("")}])([#{tags.join("")}])(\2*[#\\]?[\w:.\/\[\]-]+?\S?)\2(?!\2)([#{all_tags.join("")}]|\W|$)/
156+
re = /(^|\W|#{all_tags})(#{tags})(\2*[#\\]?[\w:#{PROTECT_ATTR}.\/\[\]-]+?\S?)\2(?!\2)(#{all_tags}|\W|$)/
156157

157158
1 while str.gsub!(re) { |orig|
158159
attr = @matching_word_pairs[$2]

test/rdoc/test_rdoc_markup_attribute_manager.rb

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def test_basic
145145

146146
assert_equal(["cat and ", @em_on, "5", @em_off, " dogs"],
147147
@am.flow("cat and _5_ dogs"))
148+
149+
assert_equal([@tt_on, "__id__", @tt_off], @am.flow("+__id__+"))
148150
end
149151

150152
def test_bold

0 commit comments

Comments
 (0)