Debian Codegraph @

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

raw
1 {#- Template for "Functions" sections in docstrings.
2
3 This template renders a list of documented functions 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 functions 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("Methods:") if obj.is_class else lang.t("Functions:") }}</span></p>
25 <table>
26 <thead>
27 <tr>
28 <th>{{ lang.t("Name") }}</th>
29 <th>{{ lang.t("Description") }}</th>
30 </tr>
31 </thead>
32 <tbody>
33 {% for function in section.value %}
34 {% if not function.name == "__init__" or not config.merge_init_into_class %}
35 <tr class="doc-section-item">
36 <td><code><autoref identifier="{{ obj.path }}.{{ function.name }}" optional hover>{{ function.name }}</autoref></code></td>
37 <td>
38 <div class="doc-md-description">
39 {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
40 </div>
41 </td>
42 </tr>
43 {% endif %}
44 {% endfor %}
45 </tbody>
46 </table>
47 {% endblock table_style %}
48 {% elif config.docstring_section_style == "list" %}
49 {% block list_style scoped %}
50 {#- Block for the `list` section style. -#}
51 <p><span class="doc-section-title">{{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}</span></p>
52 <ul>
53 {% for function in section.value %}
54 {% if not function.name == "__init__" or not config.merge_init_into_class %}
55 <li class="doc-section-item field-body">
56 <b><code><autoref identifier="{{ obj.path }}.{{ function.name }}" optional hover>{{ function.name }}</autoref></code></b>
57 –
58 <div class="doc-md-description">
59 {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
60 </div>
61 </li>
62 {% endif %}
63 {% endfor %}
64 </ul>
65 {% endblock list_style %}
66 {% elif config.docstring_section_style == "spacy" %}
67 {% block spacy_style scoped %}
68 {#- Block for the `spacy` section style. -#}
69 <table>
70 <thead>
71 <tr>
72 <th><span class="doc-section-title">{{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }}</span></th>
73 <th><span>{{ lang.t("DESCRIPTION") }}</span></th>
74 </tr>
75 </thead>
76 <tbody>
77 {% for function in section.value %}
78 {% if not function.name == "__init__" or not config.merge_init_into_class %}
79 <tr class="doc-section-item">
80 <td><code><autoref identifier="{{ obj.path }}.{{ function.name }}" optional hover>{{ function.name }}</autoref></code></td>
81 <td class="doc-function-details">
82 <div class="doc-md-description">
83 {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
84 </div>
85 </td>
86 </tr>
87 {% endif %}
88 {% endfor %}
89 </tbody>
90 </table>
91 {% endblock spacy_style %}
92 {% endif %}