Skip to content

Commit 1df8d6d

Browse files
committed
* lib/rdoc/markup/attribute_manager.rb: fixing ri output when special
characters are inside html tags. Thanks Tomo Kazahaya! [Bug ruby#3512] * test/rdoc/test_attribute_manager.rb: corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent b782aea commit 1df8d6d

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Thu Jul 15 06:11:29 2010 Aaron Patterson <[email protected]>
2+
3+
* lib/rdoc/markup/attribute_manager.rb: fixing ri output when special
4+
characters are inside html tags. Thanks Tomo Kazahaya! [Bug #3512]
5+
16
Thu Jul 15 06:01:42 2010 Tanaka Akira <[email protected]>
27

38
* time.c (guess_local_offset): use the UTC offset of an older date on

lib/rdoc/markup/attribute_manager.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def convert_attrs(str, attrs)
112112
# first do matching ones
113113
tags = @matching_word_pairs.keys.join("")
114114

115-
re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/
115+
re = /(^|[^\w#{NULL}])([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/
116116

117117
1 while str.gsub!(re) do
118118
attr = @matching_word_pairs[$2]
@@ -228,8 +228,8 @@ def flow(str)
228228

229229
@attrs = RDoc::Markup::AttrSpan.new @str.length
230230

231-
convert_attrs @str, @attrs
232231
convert_html @str, @attrs
232+
convert_attrs @str, @attrs
233233
convert_specials @str, @attrs
234234

235235
unmask_protected_sequences

test/rdoc/test_attribute_manager.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ def setup
1111
@klass = RDoc::Markup::AttributeManager
1212
end
1313

14+
def test_convert_attrs_ignores_code
15+
collector = RDoc::Markup::AttrSpan.new 10
16+
str = 'foo <code>__send__</code> bar'
17+
@am.convert_html str, collector
18+
@am.convert_attrs str, collector
19+
assert_match(/__send__/, str)
20+
end
21+
22+
def test_convert_attrs_ignores_tt
23+
collector = RDoc::Markup::AttrSpan.new 10
24+
str = 'foo <tt>__send__</tt> bar'
25+
@am.convert_html str, collector
26+
@am.convert_attrs str, collector
27+
assert_match(/__send__/, str)
28+
end
29+
1430
def test_initial_word_pairs
1531
word_pairs = @am.matching_word_pairs
1632
assert word_pairs.is_a?(Hash)

0 commit comments

Comments
 (0)