Skip to content

Commit

Permalink
style: Improve templates indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Apr 24, 2024
1 parent 98e9796 commit da02284
Show file tree
Hide file tree
Showing 18 changed files with 1,193 additions and 1,194 deletions.
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
{{ log.debug("Rendering " + attribute.path) }}

<div class="doc doc-object doc-attribute">
{% with obj = attribute, html_id = attribute.path %}
{% with obj = attribute, html_id = attribute.path %}

{% if root %}
{% set show_full_path = config.show_root_full_path %}
{% set root_members = True %}
{% elif root_members %}
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
{% set root_members = False %}
{% else %}
{% set show_full_path = config.show_object_full_path %}
{% endif %}
{% if root %}
{% set show_full_path = config.show_root_full_path %}
{% set root_members = True %}
{% elif root_members %}
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
{% set root_members = False %}
{% else %}
{% set show_full_path = config.show_object_full_path %}
{% endif %}

{% set attribute_name = attribute.path if show_full_path else attribute.name %}

{% if not root or config.show_root_heading %}
{% filter heading(
heading_level,
role="data" if attribute.parent.kind.value == "module" else "attr",
id=html_id,
class="doc doc-heading",
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
) %}

{% set attribute_name = attribute.path if show_full_path else attribute.name %}
{% block heading scoped %}
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code>{% endif %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-attribute-name">{{ attribute_name }}</span>
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
{% if attribute.value %} = {{ attribute.value }}{% endif %}
{% endfilter %}
{% endif %}
{% endblock heading %}

{% if not root or config.show_root_heading %}
{% filter heading(
heading_level,
role="data" if attribute.parent.kind.value == "module" else "attr",
id=html_id,
class="doc doc-heading",
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
) %}
{% block labels scoped %}
{% with labels = attribute.labels %}
{% include "labels.html" with context %}
{% endwith %}
{% endblock labels %}

{% endfilter %}

{% block heading scoped %}
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code>{% endif %}
{% block signature scoped %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-attribute-name">{{ attribute_name }}</span>
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
{% if attribute.value %} = {{ attribute.value }}{% endif %}
{% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ attribute.name }}
{% endfilter %}
{% endif %}
{% endblock heading %}
{% endblock signature %}

{% block labels scoped %}
{% with labels = attribute.labels %}
{% include "labels.html" with context %}
{% endwith %}
{% endblock labels %}
{% else %}

{% endfilter %}

{% block signature scoped %}
{% if config.separate_signature %}
{% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ attribute.name }}
{% if config.show_root_toc_entry %}
{% filter heading(heading_level,
role="data" if attribute.parent.kind.value == "module" else "attr",
id=html_id,
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
hidden=True,
) %}
{% endfilter %}
{% endif %}
{% endblock signature %}

{% else %}

{% if config.show_root_toc_entry %}
{% filter heading(heading_level,
role="data" if attribute.parent.kind.value == "module" else "attr",
id=html_id,
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
hidden=True,
) %}
{% endfilter %}
{% set heading_level = heading_level - 1 %}
{% endif %}
{% set heading_level = heading_level - 1 %}
{% endif %}

<div class="doc doc-contents {% if root %}first{% endif %}">
{% block contents scoped %}
{% block docstring scoped %}
{% with docstring_sections = attribute.docstring.parsed %}
{% include "docstring.html" with context %}
{% endwith %}
{% endblock docstring %}
{% endblock contents %}
</div>
<div class="doc doc-contents {% if root %}first{% endif %}">
{% block contents scoped %}
{% block docstring scoped %}
{% with docstring_sections = attribute.docstring.parsed %}
{% include "docstring.html" with context %}
{% endwith %}
{% endblock docstring %}
{% endblock contents %}
</div>

{% endwith %}
{% endwith %}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
{% endif %}

{% with attributes = obj.attributes|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if attributes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
Expand All @@ -40,11 +40,11 @@
{% endwith %}

{% with classes = obj.classes|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if classes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
Expand All @@ -60,11 +60,11 @@
{% endwith %}

{% with functions = obj.functions|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if functions %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
Expand All @@ -83,11 +83,11 @@

{% if config.show_submodules %}
{% with modules = obj.modules|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if modules %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
Expand All @@ -108,14 +108,14 @@
{% else %}

{% for child in obj.all_members
|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
)
|order_members(config.members_order, members_list)
%}
|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
)
|order_members(config.members_order, members_list)
%}

{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}

Expand Down
Loading

0 comments on commit da02284

Please sign in to comment.