Skip to content

Commit

Permalink
refactor: Sync templates with insiders, remove useless lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Aug 24, 2023
1 parent c6f36c0 commit 38b317f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
{% 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,
Expand All @@ -23,11 +25,10 @@

{% block heading scoped %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-attribute-name">{% if show_full_path %}{{ attribute.path }}{% else %}{{ attribute.name }}{% endif %}</span>
<span class="doc doc-object-name doc-attribute-name">{{ attribute_name }}</span>
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{% if show_full_path %}{{ attribute.path }}{% else %}{{ attribute.name }}{% endif %}
{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
{{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
{% if attribute.value %} = {{ attribute.value }}{% endif %}
{% endfilter %}
{% endif %}
Expand All @@ -45,8 +46,7 @@
{% if config.separate_signature %}
{% filter highlight(language="python", inline=False) %}
{% filter format_code(config.line_length) %}
{{ attribute.name }}
{% if attribute.annotation %}: {{ attribute.annotation|safe }}{% endif %}
{{ attribute.name }}{% if attribute.annotation %}: {{ attribute.annotation|safe }}{% endif %}
{% if attribute.value %} = {{ attribute.value|safe }}{% endif %}
{% endfilter %}
{% endfilter %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
{% set show_full_path = config.show_object_full_path %}
{% endif %}

{% set class_name = class.path if show_full_path else class.name %}

{% if not root or config.show_root_heading %}

{% filter heading(heading_level,
Expand All @@ -23,16 +25,15 @@

{% block heading scoped %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-class-name">{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</span>
<span class="doc doc-object-name doc-class-name">{{ class_name }}</span>
{% elif config.merge_init_into_class and "__init__" in class.members %}
{% with function = class.members["__init__"] %}
{%+ filter highlight(language="python", inline=True) %}
{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}
{% include "signature.html" with context %}
{{ class_name }}{% include "signature.html" with context %}
{% endfilter %}
{% endwith %}
{% else %}
<code>{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</code>
<code>{{ class_name }}</code>
{% endif %}
{% endblock heading %}

Expand Down Expand Up @@ -112,11 +113,9 @@
{% endblock source %}

{% block children scoped %}
{% with obj = class %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "children.html" with context %}
{% endwith %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "children.html" with context %}
{% endblock children %}
{% endblock contents %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
{% set show_full_path = config.show_object_full_path %}
{% endif %}

{% set function_name = function.path if show_full_path else function.name %}

{% if not root or config.show_root_heading %}

{% filter heading(heading_level,
Expand All @@ -25,11 +27,10 @@

{% block heading scoped %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-function-name">{% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %}</span>
<span class="doc doc-object-name doc-function-name">{{ function_name }}</span>
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %}
{% include "signature.html" with context %}
{{ function_name }}{% include "signature.html" with context %}
{% endfilter %}
{% endif %}
{% endblock heading %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
{% set show_full_path = config.show_object_full_path %}
{% endif %}

{% set module_name = module.path if show_full_path else module.name %}

{% if not root or config.show_root_heading %}

{% filter heading(heading_level,
Expand All @@ -22,13 +24,11 @@
toc_label=module.name) %}

{% block heading scoped %}
{% with module_name = module.path if show_full_path else module.name %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-module-name">{{ module_name }}</span>
{% else %}
<code>{{ module_name }}</code>
{% endif %}
{% endwith %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-module-name">{{ module_name }}</span>
{% else %}
<code>{{ module_name }}</code>
{% endif %}
{% endblock heading %}

{% block labels scoped %}
Expand Down Expand Up @@ -60,11 +60,9 @@
{% endblock docstring %}

{% block children scoped %}
{% with obj = module %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "children.html" with context %}
{% endwith %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "children.html" with context %}
{% endblock children %}
{% endblock contents %}
</div>
Expand Down

0 comments on commit 38b317f

Please sign in to comment.