ruby-changes:65741
From: aycabta <ko1@a...>
Date: Sat, 3 Apr 2021 01:24:03 +0900 (JST)
Subject: [ruby-changes:65741] 61e1cf23ac (master): [ruby/rdoc] Treat emphasis tags as excluding other notations
https://git.ruby-lang.org/ruby.git/commit/?id=61e1cf23ac From 61e1cf23ac0d122fba3ad4cbaa402c7c94ad54d3 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Tue, 16 Mar 2021 19:01:50 +0900 Subject: [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 --- lib/rdoc/markup/attr_span.rb | 2 +- lib/rdoc/markup/attribute_manager.rb | 10 +++++----- test/rdoc/test_rdoc_markup_attribute_manager.rb | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/rdoc/markup/attr_span.rb b/lib/rdoc/markup/attr_span.rb index 6fe939f..20ef11c 100644 --- a/lib/rdoc/markup/attr_span.rb +++ b/lib/rdoc/markup/attr_span.rb @@ -17,7 +17,7 @@ class RDoc::Markup::AttrSpan https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/attr_span.rb#L17 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 diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 2de8a7c..5076451 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -75,13 +75,13 @@ class RDoc::Markup::AttributeManager https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/attribute_manager.rb#L75 @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 diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb index 2ec135d..944364b 100644 --- a/test/rdoc/test_rdoc_markup_attribute_manager.rb +++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb @@ -250,6 +250,7 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb#L250 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/