Debian Codegraph @

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

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