[前][次][番号順一覧][スレッド一覧]

ruby-changes:71469

From: Nobuyoshi <ko1@a...>
Date: Tue, 22 Mar 2022 01:32:25 +0900 (JST)
Subject: [ruby-changes:71469] 92ef73a918 (master): [ruby/rdoc] Expand the enclosing tree of the current file

https://git.ruby-lang.org/ruby.git/commit/?id=92ef73a918

From 92ef73a91833aa006d7a99886712f7583af779ec Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 22 Mar 2022 01:13:06 +0900
Subject: [ruby/rdoc] Expand the enclosing tree of the current file

https://github.com/ruby/rdoc/commit/f9f90ef2ff
---
 lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml | 5 ++++-
 test/rdoc/test_rdoc_generator_darkfish.rb                 | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

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 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml#L1
 <%- 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 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml#L15
     <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 https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_generator_darkfish.rb#L110
     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
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]