1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rdoc] Treat emphasis tags as excluding other notations

And exclusive notations don't exclude other exclusive notations.

https://github.com/ruby/rdoc/commit/b8baa9a435
This commit is contained in:
aycabta 2021-03-16 19:01:50 +09:00
parent e84d275fe6
commit 61e1cf23ac
3 changed files with 7 additions and 6 deletions

View file

@ -17,7 +17,7 @@ class RDoc::Markup::AttrSpan
def set_attrs(start, length, bits)
updated = false
for i in start ... (start+length)
if (@exclusive & @attrs[i]) == 0
if (@exclusive & @attrs[i]) == 0 || (@exclusive & bits) != 0
@attrs[i] |= bits
updated = true
end

View file

@ -75,13 +75,13 @@ class RDoc::Markup::AttributeManager
@exclusive_bitmap = 0
@attributes = RDoc::Markup::Attributes.new
add_word_pair "*", "*", :BOLD
add_word_pair "_", "_", :EM
add_word_pair "*", "*", :BOLD, true
add_word_pair "_", "_", :EM, true
add_word_pair "+", "+", :TT, true
add_html "em", :EM
add_html "i", :EM
add_html "b", :BOLD
add_html "em", :EM, true
add_html "i", :EM, true
add_html "b", :BOLD, true
add_html "tt", :TT, true
add_html "code", :TT, true
end

View file

@ -250,6 +250,7 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
assert_equal '<CODE>aaa</CODE>[:symbol]', output('+aaa+[:symbol]')
assert_equal '<CODE>aaa[:symbol]</CODE>', output('+aaa[:symbol]+')
assert_equal 'aaa[:symbol]', output('aaa[:symbol]')
assert_equal '<B><CODE>index</CODE></B>', output('<b><tt>index</tt></b>')
end
def test_exclude_tag_flow