Skip to content

Commit

Permalink
Try no page per method
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Jul 3, 2023
1 parent 21f90db commit b76efca
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ docs/stubs
docs/plot_directive
docs/jupyter_execute/
docs/migration_guides
docs/_templates
docs/source_images
docs/.doctrees/
stubs/
Expand Down
31 changes: 31 additions & 0 deletions docs/_templates/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{#
We show all the class's methods and attributes on the same page. By default, we document
all methods, including those defined by parent classes.
-#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

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

{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
28 changes: 28 additions & 0 deletions docs/_templates/class_no_inherited_members.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{# This is identical to class.rst, except for the filtering in `set wanted_methods`. -#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

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

{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
1 change: 0 additions & 1 deletion docs/custom_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
TERRA_DIRS = [
"apidoc",
"migration_guides",
"_templates",
"source_images",
]

Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ commands =
{toxinidir}/docs/tutorials \
{toxinidir}/docs/migration_guides \
{toxinidir}/docs/source_images \
{toxinidir}/docs/_templates \
{toxinidir}/docs/plot_directive \
{toxinidir}/docs/jupyter_execute \
{toxinidir}/docs/.doctrees
Expand Down

0 comments on commit b76efca

Please sign in to comment.