Skip to content

Commit

Permalink
feat(darkfish): Add Attributes section to TOC and sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
okuramasafumi committed Jun 6, 2024
1 parent 4614f05 commit 69a1911
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/rdoc/generator/template/darkfish/_sidebar_attributes.rhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%- unless klass.attributes.empty? then %>
<!-- Method Quickref -->
<div id="attribute-list-section" class="nav-section">
<h3>Atributes</h3>

<ul class="link-list" role="directory">
<%- klass.attributes.each do |attribute| -%>
<a href="#<%= attribute.aref %>"><%= h attribute.name -%></a>
<%- end -%>
</ul>
</div>
<%- end -%>
1 change: 1 addition & 0 deletions lib/rdoc/generator/template/darkfish/class.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<%= render '_sidebar_parent.rhtml' %>
<%= render '_sidebar_includes.rhtml' %>
<%= render '_sidebar_extends.rhtml' %>
<%= render '_sidebar_attributes.rhtml' %>
<%= render '_sidebar_methods.rhtml' %>
</div>
</nav>
Expand Down
12 changes: 12 additions & 0 deletions lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
<%- end -%>
</ul>

<h2 id="attributes">Attributes</h2>
<ul>
<%- @store.all_classes_and_modules.flat_map do |mod|
mod.attributes
end.sort.each do |attribute| %>
<li class="attribute">
<a href="<%= attribute.path %>"><%= h attribute.pretty_name %></a>
&mdash;
<span class="container"><%= attribute.parent.full_name %></span>
<%- end -%>
</ul>

<h2 id="methods">Methods</h2>
<ul>
<%- @store.all_classes_and_modules.flat_map do |mod|
Expand Down

0 comments on commit 69a1911

Please sign in to comment.