Skip to content

Commit

Permalink
Display breadcrumb only nested two or more levels
Browse files Browse the repository at this point in the history
  • Loading branch information
unasuke committed Feb 13, 2025
1 parent b9124e2 commit c6b4fbb
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/rdoc/generator/template/darkfish/class.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@
</nav>

<main role="main" aria-labelledby="<%=h klass.aref %>">
<ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
<% breadcrumb.each do |namespace| %>
<li>
<% if namespace[:self] %>
<span><%= namespace[:name] %></span>
<% else %>
<a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
<%# If nesting level is 1, breadcrumb list is not needed %>
<% if breadcrumb.size > 1 %>
<ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
<% breadcrumb.each do |namespace| %>
<li>
<% if namespace[:self] %>
<span><%= namespace[:name] %></span>
<% else %>
<a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
<% end %>
</li>
<% end %>
</li>
<% end %>
</ol>
</ol>
<% end %>

<h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
<%= klass.type %> <%= klass.full_name %>
Expand Down

0 comments on commit c6b4fbb

Please sign in to comment.