Skip to content

Commit

Permalink
Treat emphasis tags as excluding other notations
Browse files Browse the repository at this point in the history
And exclusive notations don't exclude other exclusive notations.
  • Loading branch information
aycabta committed Mar 16, 2021
1 parent 8222f85 commit b8baa9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/rdoc/markup/attr_span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(length, exclusive)
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
Expand Down
10 changes: 5 additions & 5 deletions lib/rdoc/markup/attribute_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def initialize
@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
Expand Down
1 change: 1 addition & 0 deletions test/rdoc/test_rdoc_markup_attribute_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def test_exclude_tag
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
Expand Down

0 comments on commit b8baa9a

Please sign in to comment.