Skip to content

Commit

Permalink
Try recommended template
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed May 4, 2024
1 parent 66f7cd1 commit 25b7591
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ API documentation

.. autosummary::
:toctree: _autosummary
:template: templates/custom-module-template.rst
:recursive:

pympipool
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:

{% block methods %}
.. automethod:: __init__
Expand All @@ -11,12 +14,8 @@
.. rubric:: {{ _('Methods') }}

.. autosummary::
:toctree: generated/

{% for item in methods %}
{% if item != "__init__" %}
~{{ name }}.{{ item }}
{% endif %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
Expand All @@ -26,8 +25,6 @@
.. rubric:: {{ _('Attributes') }}

.. autosummary::
:toctree: generated/

{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
Expand Down
66 changes: 66 additions & 0 deletions docs/templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

0 comments on commit 25b7591

Please sign in to comment.