Debian Codegraph @

src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja

raw
1 {#- Template for "Warns" sections in docstrings.
2
3 This template renders a list of documented warnings in the format
4 specified with the [`docstring_section_style`][] configuration option.
5
6 Context:
7 section (griffe.DocstringSectionAttributes): The section to render.
8 -#}
9
10 {% block logs scoped %}
11 {#- Logging block.
12
13 This block can be used to log debug messages, deprecation messages, warnings, etc.
14 -#}
15 {{ log.debug("Rendering warns section") }}
16 {% endblock logs %}
17
18 {% import "language.html.jinja" as lang with context %}
19 {#- Language module providing the `t` translation method. -#}
20
21 {% if config.docstring_section_style == "table" %}
22 {% block table_style scoped %}
23 {#- Block for the `table` section style. -#}
24 <p><span class="doc-section-title">{{ section.title or lang.t("Warns:") }}</span></p>
25 <table>
26 <thead>
27 <tr>
28 <th>{{ lang.t("Type") }}</th>
29 <th>{{ lang.t("Description") }}</th>
30 </tr>
31 </thead>
32 <tbody>
33 {% for warns in section.value %}
34 <tr class="doc-section-item">
35 <td>
36 {% if warns.annotation %}
37 {% with expression = warns.annotation, backlink_type = "emitted-by" %}
38 <code>{% include "expression.html.jinja" with context %}</code>
39 {% endwith %}
40 {% endif %}
41 </td>
42 <td>
43 <div class="doc-md-description">
44 {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
45 </div>
46 </td>
47 </tr>
48 {% endfor %}
49 </tbody>
50 </table>
51 {% endblock table_style %}
52 {% elif config.docstring_section_style == "list" %}
53 {% block list_style scoped %}
54 {#- Block for the `list` section style. -#}
55 <p><span class="doc-section-title">{{ section.title or lang.t("Warns:") }}</span></p>
56 <ul>
57 {% for warns in section.value %}
58 <li class="doc-section-item field-body">
59 {% if warns.annotation %}
60 {% with expression = warns.annotation, backlink_type = "emitted-by" %}
61 <code>{% include "expression.html.jinja" with context %}</code>
62 {% endwith %}
63 –
64 {% endif %}
65 <div class="doc-md-description">
66 {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
67 </div>
68 </li>
69 {% endfor %}
70 </ul>
71 {% endblock list_style %}
72 {% elif config.docstring_section_style == "spacy" %}
73 {% block spacy_style scoped %}
74 {#- Block for the `spacy` section style. -#}
75 <table>
76 <thead>
77 <tr>
78 <th><span class="doc-section-title">{{ (section.title or lang.t("WARNS")).rstrip(":").upper() }}</span></th>
79 <th><span>{{ lang.t("DESCRIPTION") }}</span></th>
80 </tr>
81 </thead>
82 <tbody>
83 {% for warns in section.value %}
84 <tr class="doc-section-item">
85 <td>
86 <span class="doc-warns-annotation">
87 {% with expression = warns.annotation, backlink_type = "emitted-by" %}
88 <code>{% include "expression.html.jinja" with context %}</code>
89 {% endwith %}
90 </span>
91 </td>
92 <td class="doc-warns-details">
93 <div class="doc-md-description">
94 {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
95 </div>
96 </td>
97 </tr>
98 {% endfor %}
99 </tbody>
100 </table>
101 {% endblock spacy_style %}
102 {% endif %}