Skip to content

Commit f9f90ef

Browse files
committed
Expand the enclosing tree of the current file
1 parent b7b4cda commit f9f90ef

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<%- simple_files = @files.select { |f| f.text? } %>
2+
<%- if defined?(current) -%>
3+
<%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
4+
<%- end -%>
25
<%- unless simple_files.empty? then -%>
36
<div id="fileindex-section" class="nav-section">
47
<h3>Pages</h3>
@@ -12,7 +15,7 @@
1215
<li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
1316
<%- next -%>
1417
<%- end -%>
15-
<li><details><summary><%
18+
<li><details<% if dir == n %> open<% end %>><summary><%
1619
if n == f.page_name
1720
%><a href="<%= rel_prefix %>/<%= f.path %>"><%= h n %></a><%
1821
else

test/rdoc/test_rdoc_generator_darkfish.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ def test_generate_page
110110
assert_match(re, index)
111111
summary = index[re]
112112
assert_match %r[<a href="\./outer/inner_rdoc.html">inner</a>], summary
113+
re = %r[<details open><summary><a href="\./outer_rdoc\.html">outer</a></summary>.*?</details>]m
114+
assert_match(re, File.read('outer_rdoc.html'))
115+
re = %r[<details open><summary><a href="\.\./outer_rdoc\.html">outer</a></summary>.*?</details>]m
116+
assert_match(re, File.read('outer/inner_rdoc.html'))
113117
end
114118

115119
def test_generate_dry_run

0 commit comments

Comments
 (0)