[gi-docgen/nielsdg/enum-extras: 2/2] enum template: Add more titles to navigation bar




commit 984dbcc7391524d24a3287a19d62922140639eac
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Jan 22 10:20:10 2022 +0100

    enum template: Add more titles to navigation bar
    
    The current enum template only mentions the "Description" title (and
    "Functions" if applicable). However, depending on how long the
    description might be, it's a good idea to also add a link for quick
    access to the members. There's also an error domain below that, so let's
    link that as well.

 gidocgen/templates/basic/enum.html | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gidocgen/templates/basic/enum.html b/gidocgen/templates/basic/enum.html
index 75a2e33..6ba5345 100644
--- a/gidocgen/templates/basic/enum.html
+++ b/gidocgen/templates/basic/enum.html
@@ -39,8 +39,8 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
 {{ sidebar_block(enum.type_funcs, enum.name, "Type functions", "func", "type_func") }}
 {% endblock %}
 
-{% macro navbar_block(elements, section_title, section_link) -%}
-{% if elements|length > 0 %}
+{% macro navbar_block(attribute, section_title, section_link) -%}
+{% if attribute %}
 <li class="toc-list-item"><a href="{{ section_link }}"><span class="link-text">{{ section_title 
}}</span></a></li>
 {% endif %}
 {% endmacro %}
@@ -51,6 +51,8 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     <p id="toc-title">Content</p>
     <ul class="toc-list">
       <li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
+      <li class="toc-list-item"><a href="#members"><span class="link-text">Members</span></a></li>
+      {{ navbar_block(enum.error_domain, "Error domain", "#error-domain") }}
       {{ navbar_block(enum.type_funcs, "Functions", "#type-functions") }}
     </ul>
   </nav>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]