diff --git a/docs/_templates/custom-class-template.rst b/docs/_templates/custom-class-template.rst index 16ebb2f338..ba15a844b7 100644 --- a/docs/_templates/custom-class-template.rst +++ b/docs/_templates/custom-class-template.rst @@ -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 }} diff --git a/docs/_templates/custom-exception-template.rst b/docs/_templates/custom-exception-template.rst new file mode 100644 index 0000000000..8a236e7dce --- /dev/null +++ b/docs/_templates/custom-exception-template.rst @@ -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 %} \ No newline at end of file diff --git a/docs/_templates/custom-function-template.rst b/docs/_templates/custom-function-template.rst new file mode 100644 index 0000000000..2ee7bfb269 --- /dev/null +++ b/docs/_templates/custom-function-template.rst @@ -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 %} \ No newline at end of file diff --git a/docs/_templates/custom-module-template.rst b/docs/_templates/custom-module-template.rst index ef2c09a544..3dd89e8ff0 100644 --- a/docs/_templates/custom-module-template.rst +++ b/docs/_templates/custom-module-template.rst @@ -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 }} @@ -20,6 +24,7 @@ .. autosummary:: :toctree: + :template: custom-function-template.rst {% for item in functions %} {{ item }} {%- endfor %} @@ -45,6 +50,7 @@ .. autosummary:: :toctree: + :template: custom-exception-template.rst {% for item in exceptions %} {{ item }} {%- endfor %}