diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-03-13 20:38:19 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-03-14 14:48:13 +0900 |
commit | 0bf194fb33bf69a650a4b6c62cc5577c10b5f331 (patch) | |
tree | 5c97c2d386632c1cd7eeefd455c50d4a08dea854 | |
parent | 976431d9ed1a144675c24c4e8d510171cfd7c32c (diff) | |
download | ruby-0bf194fb33bf69a650a4b6c62cc5577c10b5f331.tar.gz |
[ruby/rdoc] Start with open when only one visible class/module
https://github.com/ruby/rdoc/commit/6bb93001db
-rw-r--r-- | lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml index 787bbe42c2..d3d8da4017 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml @@ -14,18 +14,20 @@ -%><code><%= index_klass.name %></code><%- end end - -%> - <%- traverse = proc do |klasses| -%> + if top = all_classes[nil] + solo = top.one? {|klass| klass.display?} + traverse = proc do |klasses| -%> <ul class="link-list"> - <%- klasses.each do |index_klass| -%> - <%- if children = all_classes[index_klass.full_name] -%> - <li><details><summary><% link.call(index_klass) %></summary> - <%- traverse.call(children) -%> + <%- klasses.each do |index_klass| -%> + <%- if children = all_classes[index_klass.full_name] -%> + <li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary> + <%- traverse.call(children) -%> </ul></details> - <%- elsif index_klass.display? -%> + <%- elsif index_klass.display? -%> <li><% link.call(index_klass, true) %> + <%- end -%> <%- end -%> <%- end -%> + <%- traverse.call(top) -%> <%- end -%> - <%- traverse.call(all_classes[nil]) -%> </div> |