summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml5
-rw-r--r--test/rdoc/test_rdoc_generator_darkfish.rb4
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
index f3b6cf3a05..0ed683ca14 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
@@ -1,4 +1,7 @@
<%- simple_files = @files.select { |f| f.text? } %>
+<%- if defined?(current) -%>
+ <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
+<%- end -%>
<%- unless simple_files.empty? then -%>
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>
@@ -12,7 +15,7 @@
<li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
<%- next -%>
<%- end -%>
- <li><details><summary><%
+ <li><details<% if dir == n %> open<% end %>><summary><%
if n == f.page_name
%><a href="<%= rel_prefix %>/<%= f.path %>"><%= h n %></a><%
else
diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb
index 90b934dc63..ae3a4c5ebf 100644
--- a/test/rdoc/test_rdoc_generator_darkfish.rb
+++ b/test/rdoc/test_rdoc_generator_darkfish.rb
@@ -110,6 +110,10 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
assert_match(re, index)
summary = index[re]
assert_match %r[<a href="\./outer/inner_rdoc.html">inner</a>], summary
+ re = %r[<details open><summary><a href="\./outer_rdoc\.html">outer</a></summary>.*?</details>]m
+ assert_match(re, File.read('outer_rdoc.html'))
+ re = %r[<details open><summary><a href="\.\./outer_rdoc\.html">outer</a></summary>.*?</details>]m
+ assert_match(re, File.read('outer/inner_rdoc.html'))
end
def test_generate_dry_run