Skip to content

Commit dcdf4bf

Browse files
committed
Fix tag in table_of_contents.html
RDoc::Markup::AttributeManager#convert_html that is called from RDoc::Markup::AttributeManager#flow replaces HTML tags of received "str" with "NULL" characters in HTML generation for each files, and the NULL characters are removed in RDoc::Markup::AttributeManager#split_into_flow. But the String objects are reused for table_of_contents.html generation, so the tags lose at that moment. This commit fixes it with using duplicated String object.
1 parent ff81732 commit dcdf4bf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/rdoc/markup/attribute_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def add_special pattern, name
246246
# Processes +str+ converting attributes, HTML and specials
247247

248248
def flow str
249-
@str = str
249+
@str = str.dup
250250

251251
mask_protected_sequences
252252

test/test_rdoc_markup_attribute_manager.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ def test_protect
332332
@am.flow("\\_cat_<i>dog</i>"))
333333
end
334334

335+
def test_lost_tag_for_the_second_time
336+
str = "cat <tt>dog</tt>"
337+
assert_equal(["cat ", @tt_on, "dog", @tt_off],
338+
@am.flow(str))
339+
assert_equal(["cat ", @tt_on, "dog", @tt_off],
340+
@am.flow(str))
341+
end
342+
335343
def test_special
336344
@am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF)
337345

0 commit comments

Comments
 (0)