chiark / gitweb /
documentation/python: module tree showed expanders where not needed.
authorVladimír Vondruš <mosra@centrum.cz>
Tue, 7 May 2019 22:28:24 +0000 (00:28 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Tue, 21 May 2019 14:51:51 +0000 (16:51 +0200)
What the heck was I doing there.

documentation/python.py
documentation/templates/python/modules.html
documentation/test_python/inspect_string/classes.html
documentation/test_python/inspect_string/inspect_string/subpackage/__init__.py

index 97714ecd566c34b0fc50e4b4d69b031a5c5f19cf..3fea6eca150b6b4e3a0b835160cc5dfd7c9f21fd 100755 (executable)
@@ -999,12 +999,12 @@ def run(basedir, config, templates):
     # Recurse into the tree and mark every node that has nested modules with
     # has_nestaable_children.
     def mark_nested_modules(list: List[IndexEntry]):
-        has_nestaable_children = False
+        has_nestable_children = False
         for i in list:
             if i.kind != 'module': continue
-            has_nestaable_children = True
-            mark_nested_modules(i.children)
-        return has_nestaable_children
+            has_nestable_children = True
+            i.has_nestable_children = mark_nested_modules(i.children)
+        return has_nestable_children
     mark_nested_modules(state.class_index)
 
     # Create module and class index
index 0e8f614fe1a2413be3756ca1b35065156a370471..8264d2fc9960003d187744cbf7fd2584328784c0 100644 (file)
@@ -5,7 +5,7 @@
         <h1>Modules</h2>
         <ul class="m-doc">
           {% for i in index.classes|selectattr('kind', 'equalto', 'module') recursive %}
-          {% if i.children %}
+          {% if i.has_nestable_children %}
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
index e73664744ab64e27742908b46f45a571b21c535a..1b28b2359fee27b0d35ad4c746616f25dd94bb95 100644 (file)
             <a href="#" onclick="return toggle(this)">module</a> <a href="inspect_string.html" class="m-doc">inspect_string</a> <span class="m-doc">A module</span>
             <ul class="m-doc">
               <li>module <a href="inspect_string.another_module.html" class="m-doc">another_module</a> <span class="m-doc">Another module</span></li>
-              <li>module <a href="inspect_string.subpackage.html" class="m-doc">subpackage</a> <span class="m-doc">A subpackage</span></li>
+              <li class="m-doc-collapsible collapsed">
+                <a href="#" onclick="return toggle(this)">module</a> <a href="inspect_string.subpackage.html" class="m-doc">subpackage</a> <span class="m-doc">A subpackage</span>
+                <ul class="m-doc">
+                  <li>class <a href="inspect_string.subpackage.Foo.html" class="m-doc">Foo</a> <span class="m-doc">A class in a subpackage. Shouldn&#x27;t cause the module tree to have an expander for it.</span></li>
+                </ul>
+              </li>
               <li class="m-doc-collapsible collapsed">
                 <a href="#" onclick="return toggle(this)">class</a> <a href="inspect_string.Foo.html" class="m-doc">Foo</a> <span class="m-doc">The foo class</span>
                 <ul class="m-doc">
index 1fc06e458075e26e518054996293a0862b64c9af..8e6580f9f732a62e3f68aaa19d00bdfc7c4bca7f 100644 (file)
@@ -1 +1,4 @@
 """A subpackage"""
+
+class Foo:
+    """A class in a subpackage. Shouldn't cause the module tree to have an expander for it."""