diff --git a/ChangeLog b/ChangeLog index 9e26082cb4..79ffe6566f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 15 06:11:29 2010 Aaron Patterson + + * lib/rdoc/markup/attribute_manager.rb: fixing ri output when special + characters are inside html tags. Thanks Tomo Kazahaya! [Bug #3512] + Thu Jul 15 06:01:42 2010 Tanaka Akira * time.c (guess_local_offset): use the UTC offset of an older date on diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 5b9e070efb..37014b6e9f 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -112,7 +112,7 @@ class RDoc::Markup::AttributeManager # first do matching ones tags = @matching_word_pairs.keys.join("") - re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/ + re = /(^|[^\w#{NULL}])([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/ 1 while str.gsub!(re) do attr = @matching_word_pairs[$2] @@ -228,8 +228,8 @@ class RDoc::Markup::AttributeManager @attrs = RDoc::Markup::AttrSpan.new @str.length - convert_attrs @str, @attrs convert_html @str, @attrs + convert_attrs @str, @attrs convert_specials @str, @attrs unmask_protected_sequences diff --git a/test/rdoc/test_attribute_manager.rb b/test/rdoc/test_attribute_manager.rb index 9506f3b40f..e908b86b02 100644 --- a/test/rdoc/test_attribute_manager.rb +++ b/test/rdoc/test_attribute_manager.rb @@ -11,6 +11,22 @@ class TestAttributeManager < MiniTest::Unit::TestCase @klass = RDoc::Markup::AttributeManager end + def test_convert_attrs_ignores_code + collector = RDoc::Markup::AttrSpan.new 10 + str = 'foo __send__ bar' + @am.convert_html str, collector + @am.convert_attrs str, collector + assert_match(/__send__/, str) + end + + def test_convert_attrs_ignores_tt + collector = RDoc::Markup::AttrSpan.new 10 + str = 'foo __send__ bar' + @am.convert_html str, collector + @am.convert_attrs str, collector + assert_match(/__send__/, str) + end + def test_initial_word_pairs word_pairs = @am.matching_word_pairs assert word_pairs.is_a?(Hash)