Sha256: 1c6da0b6b669eb029b022c542061ee378f04c247ff7caea941aada38a6f33d6a

Contents?: true

Size: 1.16 KB

Versions: 20

Compression:

Stored size: 1.16 KB

Contents

<%- comment = if current.respond_to? :comment_location then
               current.comment_location
             else
               current.comment
             end
   table = current.parse(comment).table_of_contents.dup

   if table.length > 1 then %>
<div class="nav-section">
  <h3>Table of Contents</h3>

    <%- display_link = proc do |heading| -%>
      <a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
    <%- end -%>

    <%- list_siblings = proc do -%>
      <%- level = table.first&.level -%>
      <%- while table.first && table.first.level >= level -%>
        <%- heading = table.shift -%>
        <%- if table.first.nil? || table.first.level <= heading.level -%>
          <li><% display_link.call heading -%>
        <%- else -%>
          <li>
            <details open>
              <summary><%- display_link.call heading -%></summary>
              <ul class="link-list" role="directory">
                <% list_siblings.call %>
              </ul>
            </details>
          </li>
        <%- end -%>
      <%- end -%>
    <%- end -%>

  <ul class="link-list" role="directory">
    <% list_siblings.call %>
  </ul>
</div>
<%- end -%>

Version data entries

20 entries across 18 versions & 6 rubygems

Version Path
rdoc-6.12.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/rdoc-6.11.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rdoc-6.10.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/rdoc-6.7.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rdoc-6.8.1/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.11.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rdoc-6.7.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.10.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.9.1 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.9.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.8.1 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.8.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rdoc-6.7.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/rdoc-6.7.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.6.3.1 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.5.1.1 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.6.2 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.6.1 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.6.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
rdoc-6.5.0 lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml