diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml index bf70819f64..b1e047b5f7 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml @@ -3,16 +3,37 @@ else current.comment end - table = current.parse(comment).table_of_contents + table = current.parse(comment).table_of_contents.dup if table.length > 1 then %> <%- end -%> diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb index 6aecde5287..7a554e8ee2 100644 --- a/test/rdoc/test_rdoc_generator_darkfish.rb +++ b/test/rdoc/test_rdoc_generator_darkfish.rb @@ -73,6 +73,22 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase top_level = @store.add_file 'file.rb' top_level.add_class @klass.class, @klass.name @klass.add_class RDoc::NormalClass, 'Inner' + @klass.add_comment <<~RDOC, top_level + = Heading 1 + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + == Heading 1.1 + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + === Heading 1.1.1 + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + ==== Heading 1.1.1.1 + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + == Heading 1.2 + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat + == Heading 1.3 + non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + === Heading 1.3.1 + etc etc... + RDOC @g.generate @@ -97,6 +113,15 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase refute_match(/Ignored/, File.read('index.html')) summary = File.read('index.html')[%r[.*]m] assert_match(%r[Klass/Inner\.html".*>Inner<], summary) + klassnav = File.read('Klass.html')[%r[