[gobject-introspection: 27/30] Sort index files by type.



commit c67fbbf6b3c61748f4daf425a7cae475dbbb0bdd
Author: rockon999 <rockon999 users noreply github com>
Date:   Mon Aug 6 21:04:43 2018 -0500

    Sort index files by type.

 giscanner/doctemplates/devdocs/Gjs/namespace.tmpl | 57 ++++++++++++++++++++---
 1 file changed, 50 insertions(+), 7 deletions(-)
---
diff --git a/giscanner/doctemplates/devdocs/Gjs/namespace.tmpl 
b/giscanner/doctemplates/devdocs/Gjs/namespace.tmpl
index 5a90634a..8f5a4e7e 100644
--- a/giscanner/doctemplates/devdocs/Gjs/namespace.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/namespace.tmpl
@@ -1,14 +1,57 @@
+<%def name="get_types(n, types)">
+  <% nodes = [] %>
+  % for a in n.values():
+    % if isinstance(a, types):
+      % if formatter.should_render_node(a):
+        <% nodes.append(a) %>
+      % endif
+    % endif
+  % endfor
+  <% return nodes %>
+</%def>
+
+<%def name="render_list(nodes)">
+   <ul>
+  % for a in nodes:
+      <li>${formatter.format_inline(a, formatter.format_xref(a))}</li>
+  % endfor
+  </ul>
+</%def>
+
 <html>
 <body>
   <section>
     <h1 class="namespace">${node.name}</h1>
   </section>
-  <ul>
-  % for n in node.values():
-    % if formatter.should_render_node(n):
-      <li>${formatter.format_inline(n, formatter.format_xref(n))}</li>
-    % endif
-  % endfor
-  </ul>
+  
+      <% nodes = get_types(node, (ast.Class, ast.Interface)) %>
+      % if len(nodes) > 0:
+         <h1>Classes</h1>
+        ${render_list(nodes)}
+      % endif
+  
+      <% nodes = get_types(node, (ast.Enum)) %>
+      % if len(nodes) > 0:
+         <h1>Enums</h1>
+        ${render_list(nodes)}
+      % endif
+  
+     <% nodes = get_types(node, (ast.Function)) %>
+      % if len(nodes) > 0:
+        <h1>Functions</h1>
+        ${render_list(nodes)}
+      % endif
+  
+      <% nodes = get_types(node, (ast.Constant)) %>
+      % if len(nodes) > 0:
+        <h1>Constants</h1>
+        ${render_list(nodes)}
+      % endif
+  
+      <% nodes = get_types(node, (ast.Property)) %>
+      % if len(nodes) > 0:
+        <h1>Properties</h1>
+        ${render_list(nodes)}
+      % endif
 </body>
 </html>


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