Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[documentation] Shrink module/class headers #1325

Merged
merged 9 commits into from
Feb 4, 2025
7 changes: 6 additions & 1 deletion docs/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{{ fullname | escape | underline}}
{% set truncated_fullname = fullname.split('.')[-1] %}
{% if truncated_fullname | length < 4 %}
{% set truncated_fullname = truncated_fullname.ljust(4) %}
{% endif %}
Class - {{ truncated_fullname | escape | underline}}


.. currentmodule:: {{ module }}

Expand Down
21 changes: 21 additions & 0 deletions docs/_templates/custom-exception-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% set truncated_fullname = fullname.split('.')[-1] %}
{% if truncated_fullname | length < 4 %}
{% set truncated_fullname = truncated_fullname.ljust(4) %}
{% endif %}
Exceptions - {{ truncated_fullname | escape | underline}}


.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
21 changes: 21 additions & 0 deletions docs/_templates/custom-function-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% set truncated_fullname = fullname.split('.')[-1] %}
{% if truncated_fullname | length < 4 %}
{% set truncated_fullname = truncated_fullname.ljust(4) %}
{% endif %}
Function - {{ truncated_fullname | escape | underline}}


.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
8 changes: 7 additions & 1 deletion docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{{ fullname | escape | underline}}
{% set truncated_fullname = fullname.split('.')[-1] %}
{% if truncated_fullname | length < 4 %}
{% set truncated_fullname = truncated_fullname.ljust(4) %}
{% endif %}
Module - {{ truncated_fullname | escape | underline}}

.. automodule:: {{ fullname }}

Expand All @@ -20,6 +24,7 @@

.. autosummary::
:toctree:
:template: custom-function-template.rst
{% for item in functions %}
{{ item }}
{%- endfor %}
Expand All @@ -45,6 +50,7 @@

.. autosummary::
:toctree:
:template: custom-exception-template.rst
{% for item in exceptions %}
{{ item }}
{%- endfor %}
Expand Down