[gi-docgen/type-funcs: 10/10] template: Move type functions near constructors




commit 06a41b921d5cda775d34132e450dac1be1989f65
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Sep 1 14:01:45 2021 +0100

    template: Move type functions near constructors
    
    Type functions and constructors share a lot of similarities; plus, we
    have a bunch of type functions that act as constructors.
    
    Fixes: #99

 gidocgen/templates/basic/class.html     | 68 ++++++++++++++++-----------------
 gidocgen/templates/basic/interface.html | 54 +++++++++++++-------------
 gidocgen/templates/basic/struct.html    | 68 ++++++++++++++++-----------------
 3 files changed, 95 insertions(+), 95 deletions(-)
---
diff --git a/gidocgen/templates/basic/class.html b/gidocgen/templates/basic/class.html
index 87bc93f..8ebab5f 100644
--- a/gidocgen/templates/basic/class.html
+++ b/gidocgen/templates/basic/class.html
@@ -37,11 +37,11 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
 </div>
 
 {{ sidebar_block(class.ctors, class.name, "Constructors", "ctor", "ctor") }}
+{{ sidebar_block(class.type_funcs, class.name, "Functions", "func", "type_func") }}
 {{ sidebar_block(class.methods, class.name, "Instance methods", "method", "method") }}
 {{ sidebar_block(class.properties, class.name, "Properties", "property", "property") }}
 {{ sidebar_block(class.signals, class.name, "Signals", "signal", "signal") }}
 {{ sidebar_block(class.class_methods, class.name, "Class methods", "method", "class_method") }}
-{{ sidebar_block(class.type_funcs, class.name, "Functions", "func", "type_func") }}
 {{ sidebar_block(class.virtual_methods, class.name, "Virtual methods", "method", "vfunc") }}
 {% endblock %}
 
@@ -67,11 +67,11 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
       <li class="toc-list-item"><a href="#implements"><span class="link-text">Implements</span></a></li>
       {% endif %}
       {{ navbar_block(class.ctors, "Constructors", "#constructors") }}
+      {{ navbar_block(class.type_funcs, "Functions", "#type-functions") }}
       {{ navbar_block(class.methods, "Methods", "#methods") }}
       {{ navbar_block(class.properties, "Properties", "#properties") }}
       {{ navbar_block(class.signals, "Signals", "#signals") }}
       {{ navbar_block(class.class_methods, "Class methods", "#class-methods") }}
-      {{ navbar_block(class.type_funcs, "Functions", "#type-functions") }}
       {{ navbar_block(class.virtual_methods, "Virtual methods", "#virtual-methods") }}
     </ul>
   </nav>
@@ -215,6 +215,38 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     </div>
     {% endif %}
 
+    {% if class.type_funcs %}
+    <div class="toggle-wrapper methods">
+      <h4 id="type-functions">
+        Functions
+        <a href="#type-functions" class="anchor"></a>
+      </h4>
+
+      <div class="docblock">
+      {% for func in class.type_funcs %}
+      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
+        <h6><a href="type_func.{{ class.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
+
+        <div class="docblock">
+          {{ func.summary }}
+        </div>
+
+        {% if func.available_since or func.deprecated_since -%}
+        <div class="docblock">
+        {%- if func.available_since -%}
+        <p>Available since: {{ func.available_since }}</p>
+        {%- endif -%}
+        {%- if func.deprecated_since -%}
+        <p>Deprecated since: {{ func.deprecated_since }}</p>
+        {%- endif -%}
+        </div>
+        {%- endif %}
+      </div>
+      {% endfor %}
+      </div>
+    </div>
+    {% endif %}
+
     {% if class.show_methods %}
     <div class="toggle-wrapper methods">
       <h4 id="methods">
@@ -615,38 +647,6 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     </div>
     {% endif %} 
 
-    {% if class.type_funcs %}
-    <div class="toggle-wrapper methods">
-      <h4 id="type-functions">
-        Functions
-        <a href="#type-functions" class="anchor"></a>
-      </h4>
-
-      <div class="docblock">
-      {% for func in class.type_funcs %}
-      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
-        <h6><a href="type_func.{{ class.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
-
-        <div class="docblock">
-          {{ func.summary }}
-        </div>
-
-        {% if func.available_since or func.deprecated_since -%}
-        <div class="docblock">
-        {%- if func.available_since -%}
-        <p>Available since: {{ func.available_since }}</p>
-        {%- endif -%}
-        {%- if func.deprecated_since -%}
-        <p>Deprecated since: {{ func.deprecated_since }}</p>
-        {%- endif -%}
-        </div>
-        {%- endif %}
-      </div>
-      {% endfor %}
-      </div>
-    </div>
-    {% endif %}
-
   </section>
 </section>
 {% endblock %}
diff --git a/gidocgen/templates/basic/interface.html b/gidocgen/templates/basic/interface.html
index a590265..9bc62dd 100644
--- a/gidocgen/templates/basic/interface.html
+++ b/gidocgen/templates/basic/interface.html
@@ -36,11 +36,11 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
   </div>
 </div>
 
+{{ sidebar_block(interface.type_funcs, interface.name, "Functions", "func", "type_func") }}
 {{ sidebar_block(interface.methods, interface.name, "Instance methods", "method", "method") }}
 {{ sidebar_block(interface.properties, interface.name, "Properties", "property", "property") }}
 {{ sidebar_block(interface.signals, interface.name, "Signals", "signal", "signal") }}
 {{ sidebar_block(interface.class_methods, interface.name, "Interface methods", "method", "class_method") }}
-{{ sidebar_block(interface.type_funcs, interface.name, "Functions", "func", "type_func") }}
 {{ sidebar_block(interface.virtual_methods, interface.name, "Virtual methods", "method", "vfunc") }}
 {% endblock %}
 
@@ -56,11 +56,11 @@ 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>
+      {{ navbar_block(interface.type_funcs, "Functions", "#type-functions") }}
       {{ navbar_block(interface.methods, "Methods", "#methods") }}
       {{ navbar_block(interface.properties, "Properties", "#properties") }}
       {{ navbar_block(interface.signals, "Signals", "#signals") }}
       {{ navbar_block(interface.class_methods, "Class methods", "#class-methods") }}
-      {{ navbar_block(interface.type_funcs, "Functions", "#type-functions") }}
       {{ navbar_block(interface.virtual_methods, "Virtual methods", "#virtual-methods") }}
     </ul>
   </nav>
@@ -135,6 +135,31 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
       </div>
     </div>
 
+    {% if interface.type_funcs %}
+    <div class="methods toggle-wrapper">
+      <h4 id="type-functions">
+        Functions
+        <a href="#type-functions" class="anchor"></a>
+      </h4>
+
+      <div class="docblock">
+      {% for func in interface.type_funcs %}
+      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
+        <h6><a href="type_func.{{ interface.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
+
+        <div class="docblock">
+          {{ func.summary }}
+        </div>
+
+        {% if func.deprecated_since %}
+        <div class="docblock"><p>Deprecated since: {{ func.deprecated_since.version }}</p></div>
+        {% endif %}
+      </div>
+      {% endfor %}
+      </div>
+    </div>
+    {% endif %}
+
     {% if interface.methods %}
     <div class="methods toggle-wrapper">
       <h4 id="methods">
@@ -300,31 +325,6 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     </div>
     {% endif %}
 
-    {% if interface.type_funcs %}
-    <div class="methods toggle-wrapper">
-      <h4 id="type-functions">
-        Functions
-        <a href="#type-functions" class="anchor"></a>
-      </h4>
-
-      <div class="docblock">
-      {% for func in interface.type_funcs %}
-      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
-        <h6><a href="type_func.{{ interface.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
-
-        <div class="docblock">
-          {{ func.summary }}
-        </div>
-
-        {% if func.deprecated_since %}
-        <div class="docblock"><p>Deprecated since: {{ func.deprecated_since.version }}</p></div>
-        {% endif %}
-      </div>
-      {% endfor %}
-      </div>
-    </div>
-    {% endif %}
-
     {% if interface.virtual_methods %}
     <div class="toggle-wrapper methods">
       <h4 id="virtual-methods">
diff --git a/gidocgen/templates/basic/struct.html b/gidocgen/templates/basic/struct.html
index c07beef..0e42462 100644
--- a/gidocgen/templates/basic/struct.html
+++ b/gidocgen/templates/basic/struct.html
@@ -37,8 +37,8 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
 </div>
 
 {{ sidebar_block(struct.ctors, struct.name, "Constructors", "ctor", "ctor") }}
-{{ sidebar_block(struct.methods, struct.name, "Instance methods", "method", "method") }}
 {{ sidebar_block(struct.type_funcs, struct.name, "Functions", "func", "type_func") }}
+{{ sidebar_block(struct.methods, struct.name, "Instance methods", "method", "method") }}
 {% endblock %}
 
 {% macro navbar_block(elements, section_title, section_link) -%}
@@ -54,8 +54,8 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     <ul class="toc-list">
       <li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
       {{ navbar_block(struct.ctors, "Constructors", "#constructors") }}
-      {{ navbar_block(struct.methods, "Methods", "#methods") }}
       {{ navbar_block(struct.type_funcs, "Functions", "#type-functions") }}
+      {{ navbar_block(struct.methods, "Methods", "#methods") }}
     </ul>
   </nav>
 </div>
@@ -166,6 +166,38 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     </div>
     {% endif %}
 
+    {% if struct.type_funcs %}
+    <div class="toggle-wrapper methods">
+      <h4 id="type-functions">
+        Functions
+        <a href="#type-functions" class="anchor"></a>
+      </h4>
+
+      <div class="docblock">
+      {% for func in struct.type_funcs %}
+      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
+        <h6><a href="type_func.{{ struct.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
+
+        <div class="docblock">
+          {{ func.summary }}
+        </div>
+
+        {% if func.available_since or func.deprecated_since -%}
+        <div class="docblock">
+        {%- if func.available_since -%}
+        <p>Available since: {{ func.available_since }}</p>
+        {%- endif -%}
+        {%- if func.deprecated_since -%}
+        <p>Deprecated since: {{ func.deprecated_since }}</p>
+        {%- endif -%}
+        </div>
+        {%- endif %}
+      </div>
+      {% endfor %}
+      </div>
+    </div>
+    {% endif %}
+
     {% if struct.methods %}
     <div class="toggle-wrapper methods">
       <h4 id="methods">
@@ -199,38 +231,6 @@ SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later
     </div>
     {% endif %}
 
-    {% if struct.type_funcs %}
-    <div class="toggle-wrapper methods">
-      <h4 id="type-functions">
-        Functions
-        <a href="#type-functions" class="anchor"></a>
-      </h4>
-
-      <div class="docblock">
-      {% for func in struct.type_funcs %}
-      <div class="{% if func.deprecated_since %}deprecated{% endif %}">
-        <h6><a href="type_func.{{ struct.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
-
-        <div class="docblock">
-          {{ func.summary }}
-        </div>
-
-        {% if func.available_since or func.deprecated_since -%}
-        <div class="docblock">
-        {%- if func.available_since -%}
-        <p>Available since: {{ func.available_since }}</p>
-        {%- endif -%}
-        {%- if func.deprecated_since -%}
-        <p>Deprecated since: {{ func.deprecated_since }}</p>
-        {%- endif -%}
-        </div>
-        {%- endif %}
-      </div>
-      {% endfor %}
-      </div>
-    </div>
-    {% endif %}
-
   </section>
 </section>
 {% endblock %}


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