ruby-changes:16651
From: tenderlove <ko1@a...>
Date: Thu, 15 Jul 2010 06:23:39 +0900 (JST)
Subject: [ruby-changes:16651] Ruby:r28647 (trunk): * lib/rdoc/markup/attribute_manager.rb: fixing ri output when special
tenderlove 2010-07-15 06:13:41 +0900 (Thu, 15 Jul 2010) New Revision: 28647 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28647 Log: * lib/rdoc/markup/attribute_manager.rb: fixing ri output when special characters are inside html tags. Thanks Tomo Kazahaya! [Bug #3512] * test/rdoc/test_attribute_manager.rb: corresponding test. Modified files: trunk/ChangeLog trunk/lib/rdoc/markup/attribute_manager.rb trunk/test/rdoc/test_attribute_manager.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 28646) +++ ChangeLog (revision 28647) @@ -1,3 +1,8 @@ +Thu Jul 15 06:11:29 2010 Aaron Patterson <aaron@t...> + + * 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 <akr@f...> * time.c (guess_local_offset): use the UTC offset of an older date on Index: lib/rdoc/markup/attribute_manager.rb =================================================================== --- lib/rdoc/markup/attribute_manager.rb (revision 28646) +++ lib/rdoc/markup/attribute_manager.rb (revision 28647) @@ -112,7 +112,7 @@ # 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 @@ @attrs = RDoc::Markup::AttrSpan.new @str.length + convert_html @str, @attrs convert_attrs @str, @attrs - convert_html @str, @attrs convert_specials @str, @attrs unmask_protected_sequences Index: test/rdoc/test_attribute_manager.rb =================================================================== --- test/rdoc/test_attribute_manager.rb (revision 28646) +++ test/rdoc/test_attribute_manager.rb (revision 28647) @@ -11,6 +11,22 @@ @klass = RDoc::Markup::AttributeManager end + def test_convert_attrs_ignores_code + collector = RDoc::Markup::AttrSpan.new 10 + str = 'foo <code>__send__</code> 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 <tt>__send__</tt> 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/