From 102f7cc62a596ec62401e3a0e8523c52d57cc607 Mon Sep 17 00:00:00 2001 From: Arnau Casau <47946624+arnaucasau@users.noreply.github.com> Date: Fri, 20 Oct 2023 18:08:22 +0200 Subject: [PATCH] Fix docs templates (#84) --- docs/_templates/autosummary/class.rst | 27 +++++------- .../class_no_inherited_members.rst | 41 +++++++++++++++++++ 2 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 docs/_templates/autosummary/class_no_inherited_members.rst diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst index 422dfea..f819fa6 100644 --- a/docs/_templates/autosummary/class.rst +++ b/docs/_templates/autosummary/class.rst @@ -8,37 +8,30 @@ .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} - :show-inheritance: :no-members: :no-inherited-members: :no-special-members: + :show-inheritance: - {% block attributes_summary %} +{% block attributes_summary %} {% if attributes %} .. rubric:: Attributes - {% for item in all_attributes %} - {%- if not item.startswith('_') %} + {% for item in all_attributes %} + {%- if not item.startswith('_') %} .. autoattribute:: {{ name }}.{{ item }} - {%- endif -%} - {%- endfor %} + {%- endif -%} + {%- endfor %} {% endif %} - {% endblock %} +{% endblock %} - {% block methods_summary %} +{% block methods_summary %} {% if methods %} .. rubric:: Methods {% for item in all_methods %} - {%- if item not in inherited_members %} - {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - .. automethod:: {{ name }}.{{ item }} - {%- endif -%} - {%- endif -%} - {%- endfor %} - {% for item in inherited_members %} - {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} + {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} - {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/docs/_templates/autosummary/class_no_inherited_members.rst b/docs/_templates/autosummary/class_no_inherited_members.rst new file mode 100644 index 0000000..6ed7e5c --- /dev/null +++ b/docs/_templates/autosummary/class_no_inherited_members.rst @@ -0,0 +1,41 @@ +{# This is identical to class.rst, except for the filtering of the inherited_members. -#} + +{% if referencefile %} +.. include:: {{ referencefile }} +{% endif %} + +{{ objname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :no-members: + :no-inherited-members: + :no-special-members: + :show-inheritance: + +{% block attributes_summary %} + {% if attributes %} + .. rubric:: Attributes + {% for item in all_attributes %} + {%- if not item.startswith('_') %} + .. autoattribute:: {{ name }}.{{ item }} + {%- endif -%} + {%- endfor %} + {% endif %} +{% endblock %} + +{% block methods_summary %} + {% if methods %} + .. rubric:: Methods + {% for item in all_methods %} + {%- if item not in inherited_members %} + {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} + .. automethod:: {{ name }}.{{ item }} + {%- endif -%} + {%- endif -%} + {%- endfor %} + + {% endif %} +{% endblock %} \ No newline at end of file