Skip to content

Commit da02284

Browse files
committed
style: Improve templates indentation
1 parent 98e9796 commit da02284

File tree

18 files changed

+1193
-1194
lines changed

18 files changed

+1193
-1194
lines changed
Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
11
{{ log.debug("Rendering " + attribute.path) }}
22

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

6-
{% if root %}
7-
{% set show_full_path = config.show_root_full_path %}
8-
{% set root_members = True %}
9-
{% elif root_members %}
10-
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
11-
{% set root_members = False %}
12-
{% else %}
13-
{% set show_full_path = config.show_object_full_path %}
14-
{% endif %}
6+
{% if root %}
7+
{% set show_full_path = config.show_root_full_path %}
8+
{% set root_members = True %}
9+
{% elif root_members %}
10+
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
11+
{% set root_members = False %}
12+
{% else %}
13+
{% set show_full_path = config.show_object_full_path %}
14+
{% endif %}
15+
16+
{% set attribute_name = attribute.path if show_full_path else attribute.name %}
17+
18+
{% if not root or config.show_root_heading %}
19+
{% filter heading(
20+
heading_level,
21+
role="data" if attribute.parent.kind.value == "module" else "attr",
22+
id=html_id,
23+
class="doc doc-heading",
24+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
25+
) %}
1526

16-
{% set attribute_name = attribute.path if show_full_path else attribute.name %}
27+
{% block heading scoped %}
28+
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code>{% endif %}
29+
{% if config.separate_signature %}
30+
<span class="doc doc-object-name doc-attribute-name">{{ attribute_name }}</span>
31+
{% else %}
32+
{%+ filter highlight(language="python", inline=True) %}
33+
{{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
34+
{% if attribute.value %} = {{ attribute.value }}{% endif %}
35+
{% endfilter %}
36+
{% endif %}
37+
{% endblock heading %}
1738

18-
{% if not root or config.show_root_heading %}
19-
{% filter heading(
20-
heading_level,
21-
role="data" if attribute.parent.kind.value == "module" else "attr",
22-
id=html_id,
23-
class="doc doc-heading",
24-
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
25-
) %}
39+
{% block labels scoped %}
40+
{% with labels = attribute.labels %}
41+
{% include "labels.html" with context %}
42+
{% endwith %}
43+
{% endblock labels %}
44+
45+
{% endfilter %}
2646

27-
{% block heading scoped %}
28-
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-attribute"></code>{% endif %}
47+
{% block signature scoped %}
2948
{% if config.separate_signature %}
30-
<span class="doc doc-object-name doc-attribute-name">{{ attribute_name }}</span>
31-
{% else %}
32-
{%+ filter highlight(language="python", inline=True) %}
33-
{{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
34-
{% if attribute.value %} = {{ attribute.value }}{% endif %}
49+
{% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
50+
{{ attribute.name }}
3551
{% endfilter %}
3652
{% endif %}
37-
{% endblock heading %}
53+
{% endblock signature %}
3854

39-
{% block labels scoped %}
40-
{% with labels = attribute.labels %}
41-
{% include "labels.html" with context %}
42-
{% endwith %}
43-
{% endblock labels %}
55+
{% else %}
4456

45-
{% endfilter %}
46-
47-
{% block signature scoped %}
48-
{% if config.separate_signature %}
49-
{% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
50-
{{ attribute.name }}
57+
{% if config.show_root_toc_entry %}
58+
{% filter heading(heading_level,
59+
role="data" if attribute.parent.kind.value == "module" else "attr",
60+
id=html_id,
61+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
62+
hidden=True,
63+
) %}
5164
{% endfilter %}
5265
{% endif %}
53-
{% endblock signature %}
54-
55-
{% else %}
56-
57-
{% if config.show_root_toc_entry %}
58-
{% filter heading(heading_level,
59-
role="data" if attribute.parent.kind.value == "module" else "attr",
60-
id=html_id,
61-
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-attribute"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + attribute.name,
62-
hidden=True,
63-
) %}
64-
{% endfilter %}
66+
{% set heading_level = heading_level - 1 %}
6567
{% endif %}
66-
{% set heading_level = heading_level - 1 %}
67-
{% endif %}
6868

69-
<div class="doc doc-contents {% if root %}first{% endif %}">
70-
{% block contents scoped %}
71-
{% block docstring scoped %}
72-
{% with docstring_sections = attribute.docstring.parsed %}
73-
{% include "docstring.html" with context %}
74-
{% endwith %}
75-
{% endblock docstring %}
76-
{% endblock contents %}
77-
</div>
69+
<div class="doc doc-contents {% if root %}first{% endif %}">
70+
{% block contents scoped %}
71+
{% block docstring scoped %}
72+
{% with docstring_sections = attribute.docstring.parsed %}
73+
{% include "docstring.html" with context %}
74+
{% endwith %}
75+
{% endblock docstring %}
76+
{% endblock contents %}
77+
</div>
7878

79-
{% endwith %}
79+
{% endwith %}
8080
</div>

src/mkdocstrings_handlers/python/templates/material/_base/children.html

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
{% endif %}
2121

2222
{% with attributes = obj.attributes|filter_objects(
23-
filters=config.filters,
24-
members_list=members_list,
25-
inherited_members=config.inherited_members,
26-
keep_no_docstrings=config.show_if_no_docstring,
27-
) %}
23+
filters=config.filters,
24+
members_list=members_list,
25+
inherited_members=config.inherited_members,
26+
keep_no_docstrings=config.show_if_no_docstring,
27+
) %}
2828
{% if attributes %}
2929
{% if config.show_category_heading %}
3030
{% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
@@ -40,11 +40,11 @@
4040
{% endwith %}
4141

4242
{% with classes = obj.classes|filter_objects(
43-
filters=config.filters,
44-
members_list=members_list,
45-
inherited_members=config.inherited_members,
46-
keep_no_docstrings=config.show_if_no_docstring,
47-
) %}
43+
filters=config.filters,
44+
members_list=members_list,
45+
inherited_members=config.inherited_members,
46+
keep_no_docstrings=config.show_if_no_docstring,
47+
) %}
4848
{% if classes %}
4949
{% if config.show_category_heading %}
5050
{% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
@@ -60,11 +60,11 @@
6060
{% endwith %}
6161

6262
{% with functions = obj.functions|filter_objects(
63-
filters=config.filters,
64-
members_list=members_list,
65-
inherited_members=config.inherited_members,
66-
keep_no_docstrings=config.show_if_no_docstring,
67-
) %}
63+
filters=config.filters,
64+
members_list=members_list,
65+
inherited_members=config.inherited_members,
66+
keep_no_docstrings=config.show_if_no_docstring,
67+
) %}
6868
{% if functions %}
6969
{% if config.show_category_heading %}
7070
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
@@ -83,11 +83,11 @@
8383

8484
{% if config.show_submodules %}
8585
{% with modules = obj.modules|filter_objects(
86-
filters=config.filters,
87-
members_list=members_list,
88-
inherited_members=config.inherited_members,
89-
keep_no_docstrings=config.show_if_no_docstring,
90-
) %}
86+
filters=config.filters,
87+
members_list=members_list,
88+
inherited_members=config.inherited_members,
89+
keep_no_docstrings=config.show_if_no_docstring,
90+
) %}
9191
{% if modules %}
9292
{% if config.show_category_heading %}
9393
{% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
@@ -108,14 +108,14 @@
108108
{% else %}
109109

110110
{% for child in obj.all_members
111-
|filter_objects(
112-
filters=config.filters,
113-
members_list=members_list,
114-
inherited_members=config.inherited_members,
115-
keep_no_docstrings=config.show_if_no_docstring,
116-
)
117-
|order_members(config.members_order, members_list)
118-
%}
111+
|filter_objects(
112+
filters=config.filters,
113+
members_list=members_list,
114+
inherited_members=config.inherited_members,
115+
keep_no_docstrings=config.show_if_no_docstring,
116+
)
117+
|order_members(config.members_order, members_list)
118+
%}
119119

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy