Skip to content

Commit cd2bb47

Browse files
committed
Treat emphasis tags as excluding other notations
And exclusive notations don't exclude other exclusive notations.
1 parent dd7e94c commit cd2bb47

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/rdoc/markup/attr_span.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(length, exclusive)
1717
def set_attrs(start, length, bits)
1818
updated = false
1919
for i in start ... (start+length)
20-
if (@exclusive & @attrs[i]) == 0
20+
if (@exclusive & @attrs[i]) == 0 || (@exclusive | bits) != 0
2121
@attrs[i] |= bits
2222
updated = true
2323
end

lib/rdoc/markup/attribute_manager.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def initialize
7575
@exclusive_bitmap = 0
7676
@attributes = RDoc::Markup::Attributes.new
7777

78-
add_word_pair "*", "*", :BOLD
79-
add_word_pair "_", "_", :EM
78+
add_word_pair "*", "*", :BOLD, true
79+
add_word_pair "_", "_", :EM, true
8080
add_word_pair "+", "+", :TT, true
8181

82-
add_html "em", :EM
83-
add_html "i", :EM
84-
add_html "b", :BOLD
82+
add_html "em", :EM, true
83+
add_html "i", :EM, true
84+
add_html "b", :BOLD, true
8585
add_html "tt", :TT, true
8686
add_html "code", :TT, true
8787
end

test/rdoc/test_rdoc_markup_attribute_manager.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def test_exclude_tag
250250
assert_equal '<CODE>aaa</CODE>[:symbol]', output('+aaa+[:symbol]')
251251
assert_equal '<CODE>aaa[:symbol]</CODE>', output('+aaa[:symbol]+')
252252
assert_equal 'aaa[:symbol]', output('aaa[:symbol]')
253+
assert_equal '<B><CODE>index</CODE><B>', output('<b><tt>index</tt></b>')
253254
end
254255

255256
def test_exclude_tag_flow

0 commit comments

Comments
 (0)