Debian Codegraph @

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

raw
1 {#- Template for "Receives" sections in docstrings.
2
3 This template renders a list of documented received values (generators) 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 receives 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 {% set name_column = section.value|selectattr("name")|any %}
25 <p><span class="doc-section-title">{{ section.title or lang.t("Receives:") }}</span></p>
26 <table>
27 <thead>
28 <tr>
29 {% if name_column %}<th>{{ lang.t("Name") }}</th>{% endif %}
30 <th>{{ lang.t("Type") }}</th>
31 <th>{{ lang.t("Description") }}</th>
32 </tr>
33 </thead>
34 <tbody>
35 {% for receives in section.value %}
36 <tr class="doc-section-item">
37 {% if name_column %}<td>{% if receives.name %}<code>{{ receives.name }}</code>{% endif %}</td>{% endif %}
38 <td>
39 {% if receives.annotation %}
40 {% with expression = receives.annotation, backlink_type = "received-by" %}
41 <code>{% include "expression.html.jinja" with context %}</code>
42 {% endwith %}
43 {% endif %}
44 </td>
45 <td>
46 <div class="doc-md-description">
47 {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
48 </div>
49 </td>
50 </tr>
51 {% endfor %}
52 </tbody>
53 </table>
54 {% endblock table_style %}
55 {% elif config.docstring_section_style == "list" %}
56 {% block list_style scoped %}
57 {#- Block for the `list` section style. -#}
58 <p><span class="doc-section-title">{{ section.title or lang.t("Receives:") }}</span></p>
59 <ul>
60 {% for receives in section.value %}
61 <li class="doc-section-item field-body">
62 {% if receives.name %}<b><code>{{ receives.name }}</code></b>{% endif %}
63 {% if receives.annotation %}
64 {% with expression = receives.annotation, backlink_type = "received-by" %}
65 {% if receives.name %} ({% endif %}
66 <code>{% include "expression.html.jinja" with context %}</code>
67 {% if receives.name %}){% endif %}
68 {% endwith %}
69 {% endif %}
70 –
71 <div class="doc-md-description">
72 {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
73 </div>
74 </li>
75 {% endfor %}
76 </ul>
77 {% endblock list_style %}
78 {% elif config.docstring_section_style == "spacy" %}
79 {% block spacy_style scoped %}
80 {#- Block for the `spacy` section style. -#}
81 <table>
82 <thead>
83 <tr>
84 <th><span class="doc-section-title">{{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }}</span></th>
85 <th><span>{{ lang.t("DESCRIPTION") }}</span></th>
86 </tr>
87 </thead>
88 <tbody>
89 {% for receives in section.value %}
90 <tr class="doc-section-item">
91 <td>
92 {% if receives.name %}
93 <code>{{ receives.name }}</code>
94 {% elif receives.annotation %}
95 <span class="doc-receives-annotation">
96 {% with expression = receives.annotation, backlink_type = "received-by" %}
97 <code>{% include "expression.html.jinja" with context %}</code>
98 {% endwith %}
99 </span>
100 {% endif %}
101 </td>
102 <td class="doc-receives-details">
103 <div class="doc-md-description">
104 {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
105 </div>
106 {% if receives.name and receives.annotation %}
107 <p>
108 <span class="doc-receives-annotation">
109 <b>{{ lang.t("TYPE:") }}</b>
110 {% with expression = receives.annotation, backlink_type = "received-by" %}
111 <code>{% include "expression.html.jinja" with context %}</code>
112 {% endwith %}
113 </span>
114 </p>
115 {% endif %}
116 </td>
117 </tr>
118 {% endfor %}
119 </tbody>
120 </table>
121 {% endblock spacy_style %}
122 {% endif %}