Debian Codegraph @

src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja

raw
1 {#- Template for Python modules.
2
3 This template renders a Python module.
4
5 Context:
6 module (griffe.Module): The module to render.
7 root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
8 heading_level (int): The HTML heading level to use.
9 config (dict): The configuration options.
10 -#}
11
12 {% block logs scoped %}
13 {#- Logging block.
14
15 This block can be used to log debug messages, deprecation messages, warnings, etc.
16 -#}
17 {{ log.debug("Rendering " + module.path) }}
18 {% endblock logs %}
19
20 <div class="doc doc-object doc-module">
21 {% with obj = module, html_id = module.path %}
22
23 {% if root %}
24 {% set show_full_path = config.show_root_full_path %}
25 {% set root_members = True %}
26 {% elif root_members %}
27 {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
28 {% set root_members = False %}
29 {% else %}
30 {% set show_full_path = config.show_object_full_path %}
31 {% endif %}
32
33 {% set module_name = module.path if show_full_path else module.name %}
34
35 {% if not root or config.show_root_heading %}
36 {% filter heading(
37 heading_level,
38 role="module",
39 id=html_id,
40 class="doc doc-heading",
41 toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
42 skip_inventory=config.skip_local_inventory,
43 ) %}
44
45 {% block heading scoped %}
46 {#- Heading block.
47
48 This block renders the heading for the module.
49 -#}
50 {% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-module"></code>{% endif %}
51 {% if config.heading and root %}
52 {{ config.heading }}
53 {% elif config.separate_signature %}
54 <span class="doc doc-object-name doc-module-name">{{ module_name }}</span>
55 {% else %}
56 <code>{{ module_name }}</code>
57 {% endif %}
58 {% endblock heading %}
59
60 {% block labels scoped %}
61 {#- Labels block.
62
63 This block renders the labels for the module.
64 -#}
65 {% with labels = module.labels %}
66 {% include "labels.html.jinja" with context %}
67 {% endwith %}
68 {% endblock labels %}
69
70 {% endfilter %}
71
72 {% else %}
73 {% if config.show_root_toc_entry %}
74 {% filter heading(heading_level,
75 role="module",
76 id=html_id,
77 toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-module"></code>&nbsp;'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
78 hidden=True,
79 skip_inventory=config.skip_local_inventory,
80 ) %}
81 {% endfilter %}
82 {% endif %}
83 {% set heading_level = heading_level - 1 %}
84 {% endif %}
85
86 <div class="doc doc-contents {% if root %}first{% endif %}">
87 {% block contents scoped %}
88 {#- Contents block.
89
90 This block renders the contents of the module.
91 It contains other blocks that users can override.
92 Overriding the contents block allows to rearrange the order of the blocks.
93 -#}
94 {% block docstring scoped %}
95 {#- Docstring block.
96
97 This block renders the docstring for the module.
98 -#}
99 {% with docstring_sections = module.docstring.parsed %}
100 {% include "docstring.html.jinja" with context %}
101 {% endwith %}
102 {% endblock docstring %}
103
104 {% if config.backlinks %}
105 <backlinks identifier="{{ html_id }}" handler="python" />
106 {% endif %}
107
108 {% block summary scoped %}
109 {#- Summary block.
110
111 This block renders auto-summaries for classes, methods, and attributes.
112 -#}
113 {% include "summary.html.jinja" with context %}
114 {% endblock summary %}
115
116 {% block children scoped %}
117 {#- Children block.
118
119 This block renders the children (members) of the module.
120 -#}
121 {% set root = False %}
122 {% set heading_level = heading_level + 1 %}
123 {% include "children.html.jinja" with context %}
124 {% endblock children %}
125 {% endblock contents %}
126 </div>
127
128 {% endwith %}
129 </div>