Skip to content

fix: cleanup autoapi templates using macros #556

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

Merged
merged 21 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
979a9d9
feat: add macros for autoapi
Revathyvenugopal162 Oct 17, 2024
0748b7c
chore: adding changelog file 556.fixed.md [dependabot-skip]
pyansys-ci-bot Oct 17, 2024
ad98496
fix : update the details methods to macro
Revathyvenugopal162 Oct 17, 2024
ea3c51e
Merge branch 'fix/marcros-jinja' of https://github.com/ansys/ansys-sp…
Revathyvenugopal162 Oct 17, 2024
f8b49aa
fix: add render heading
Revathyvenugopal162 Oct 17, 2024
7c859ac
fix: spaces
Revathyvenugopal162 Oct 17, 2024
935c1ce
Merge branch 'main' into fix/marcros-jinja
Revathyvenugopal162 Oct 17, 2024
5497803
Merge branch 'main' into fix/marcros-jinja
Revathyvenugopal162 Oct 18, 2024
7e1a48c
Merge branch 'main' into fix/marcros-jinja
Revathyvenugopal162 Oct 18, 2024
7d59778
Merge branch 'main' into fix/marcros-jinja
Revathyvenugopal162 Oct 18, 2024
79d9941
Update src/ansys_sphinx_theme/theme/ansys_sphinx_theme/_templates/aut…
Revathyvenugopal162 Oct 18, 2024
8507546
chore: adding changelog file 556.miscellaneous.md [dependabot-skip]
pyansys-ci-bot Oct 18, 2024
e333f4c
fix: rename the heading -> title
Revathyvenugopal162 Oct 18, 2024
3ffb1e3
fix: order of arguments and revert the number of parameters
Revathyvenugopal162 Oct 18, 2024
55d95fb
fix: order in args
Revathyvenugopal162 Oct 18, 2024
05fee14
Merge branch 'main' into fix/marcros-jinja
Revathyvenugopal162 Oct 23, 2024
daa8c1f
fix: change order
Revathyvenugopal162 Oct 23, 2024
0c5664b
Merge branch 'main' into fix/marcros-jinja
jorgepiloto Oct 23, 2024
1c90dec
fix: naming of macros
jorgepiloto Oct 23, 2024
0edd3b2
fix: typo
Revathyvenugopal162 Oct 23, 2024
67f3247
fix: unnecessary check
jorgepiloto Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/556.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: cleanup autoapi templates using macros
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,39 @@
- {{ obj.summary }}
{% endfor %}
{%- endmacro %}
{# --------------------------- End macros definition ----------------------- #}

{# ------------------------ End macros definition for tab ------------------- #}

{# ----------------- Start macros definition for autosummary -----------------#}

{% macro render_autosummary_section(title, members) -%}

{{ title }}
{{ "-" * title | length }}

.. autoapisummary::

{% for member in members %}
{{ member.id }}
{% endfor %}

{%- endmacro %}
{# ------------------ End macros definition for autosummary --------------- #}

{# ----------------- Start macros definition for headers -----------------#}

{% macro render_members_section(title, members) -%}

{{ title }}
{{ "-" * title | length }}

{% for member in members %}
{{ member.render() }}
{% endfor %}

{%- endmacro %}
{# ------------------ End macros definition for headers --------------- #}


{% if is_own_page %}
:class:`{{ obj.name }}`
Expand Down Expand Up @@ -140,84 +172,40 @@ Import detail
from {{ joined_parts }} import {{ obj["short_name"] }}

{% if visible_properties %}
Property detail
---------------
{% for property in visible_properties %}
{{ property.render() }}
{% endfor %}
{{ render_members_section("Property detail", visible_properties) }}
{% endif %}


{% if visible_attributes %}
Attribute detail
----------------
{% for attribute in visible_attributes %}
{{ attribute.render() }}
{% endfor %}
{% if visible_attributes %}
{{ render_members_section("Attribute detail", visible_attributes) }}
{% endif %}


{% if all_visible_methods %}
Method detail
-------------
{% for method in all_visible_methods %}
{{ method.render() }}
{% endfor %}
{% if all_visible_methods %}
{{ render_members_section("Method detail", all_visible_methods) }}
{% endif %}

{% if is_own_page and own_page_children %}
{% set visible_attributes = own_page_children|selectattr("type", "equalto", "attribute")|list %}
{% if visible_attributes %}
Attributes
----------

.. autoapisummary::

{% for attribute in visible_attributes %}
{{ attribute.id }}
{% endfor %}


{% endif %}
{% set visible_exceptions = own_page_children|selectattr("type", "equalto", "exception")|list %}
{% if visible_exceptions %}
Exceptions
----------

.. autoapisummary::

{% for exception in visible_exceptions %}
{{ exception.id }}
{% endfor %}


{% endif %}
{% set visible_classes = own_page_children|selectattr("type", "equalto", "class")|list %}
{% if visible_classes %}
Classes
-------

.. autoapisummary::

{% for klass in visible_classes %}
{{ klass.id }}
{% endfor %}


{% endif %}
{% set visible_methods = own_page_children|selectattr("type", "equalto", "method")|list %}
{% if visible_methods %}
Methods
-------
{% if visible_attributes %}
{{ autosummary_section("Attributes", visible_attributes) }}
{% endif %}
{% set visible_exceptions = own_page_children|selectattr("type", "equalto", "exception")|list %}

.. autoapisummary::
{% if visible_exceptions %}
{{ autosummary_section("Exceptions", visible_exceptions) }}
{% endif %}
{% set visible_classes = own_page_children|selectattr("type", "equalto", "class")|list %}

{% for method in visible_methods %}
{{ method.id }}
{% endfor %}
{% if visible_classes %}
{{ autosummary_section("Classes", visible_classes) }}

{% endif %}
{% set visible_methods = own_page_children|selectattr("type", "equalto", "method")|list %}

{% endif %}
{% if visible_methods %}
{{ autosummary_section("Methods", visible_methods) }}
{% endif %}
{% endif %}

{# ---------------------- End class details -------------------- #}
{% endif %}
{% endif %}
Loading