summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrockon999 <rockon999@users.noreply.github.com>2018-08-06 21:04:43 -0500
committerrockon999 <rockon999@users.noreply.github.com>2018-08-06 21:04:43 -0500
commitc67fbbf6b3c61748f4daf425a7cae475dbbb0bdd (patch)
tree833d77fc28d3e590375ff4afdb0472129e9f3a36
parent5e6266e576d94ad298202c493d045c57cfe4f87f (diff)
downloadgobject-introspection-c67fbbf6b3c61748f4daf425a7cae475dbbb0bdd.tar.gz
Sort index files by type.
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/namespace.tmpl57
1 files 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>