From dedfceab15dcedcb60071fb9f3a082b4c18d114f Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Thu, 19 Mar 2020 21:45:25 +0100
Subject: [PATCH] [doc] Auto-document configuration objects

---
 doc/_templates/config.rst | 38 ++++++++++++++++++++++++++++++++++++++
 doc/api.rst               |  3 +--
 2 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 doc/_templates/config.rst

diff --git a/doc/_templates/config.rst b/doc/_templates/config.rst
new file mode 100644
index 00000000..0c315cc0
--- /dev/null
+++ b/doc/_templates/config.rst
@@ -0,0 +1,38 @@
+{{ fullname | escape | underline}}
+
+.. automodule:: {{ fullname }}
+
+   {% block functions %}
+   {% if functions %}
+   .. rubric:: Functions
+
+   .. autosummary::
+   {% for item in functions %}
+      {{ item }}
+   {%- endfor %}
+   {% endif %}
+   {% endblock %}
+
+   {% block classes %}
+   {% if classes %}
+   .. rubric:: Classes
+
+   .. autosummary::
+   {% for item in classes %}
+      {{ item }}
+   {%- endfor %}
+   {% endif %}
+   {% endblock %}
+
+   {% block exceptions %}
+   {% if exceptions %}
+   .. rubric:: Exceptions
+
+   .. autosummary::
+   {% for item in exceptions %}
+      {{ item }}
+   {%- endfor %}
+   {% endif %}
+   {% endblock %}
+
+.. literalinclude:: ../../../../{{ fullname.replace(".", "/") }}.py
diff --git a/doc/api.rst b/doc/api.rst
index 5142bd59..d178eb98 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -107,8 +107,8 @@ Models
 
 .. autosummary::
    :toctree: api/configs/models
+   :template: config.rst
 
-   bob.ip.binseg.configs.models
    bob.ip.binseg.configs.models.driu
    bob.ip.binseg.configs.models.driubn
    bob.ip.binseg.configs.models.driubnssl
@@ -127,7 +127,6 @@ Datasets
 .. autosummary::
    :toctree: api/configs/datasets
 
-   bob.ip.binseg.configs.datasets
    bob.ip.binseg.configs.datasets.amdrive
    bob.ip.binseg.configs.datasets.amdrivetest
    bob.ip.binseg.configs.datasets.chasedb1
-- 
GitLab