Skip to content

Commit aaa79ee

Browse files
committed
feat: Add Jinja blocks around docstring section styles
1 parent 7e17fc4 commit aaa79ee

File tree

8 files changed

+48
-0
lines changed

8 files changed

+48
-0
lines changed

src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering attributes section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
<p><strong>{{ section.title or "Attributes:" }}</strong></p>
45
<table>
56
<thead>
@@ -25,7 +26,9 @@
2526
{% endfor %}
2627
</tbody>
2728
</table>
29+
{% endblock table_style %}
2830
{% elif config.docstring_section_style == "list" %}
31+
{% block list_style %}
2932
<p>{{ section.title or "Attributes:" }}</p>
3033
<ul>
3134
{% for attribute in section.value %}
@@ -40,7 +43,9 @@
4043
</li>
4144
{% endfor %}
4245
</ul>
46+
{% endblock list_style %}
4347
{% elif config.docstring_section_style == "spacy" %}
48+
{% block spacy_style %}
4449
<table>
4550
<thead>
4651
<tr>
@@ -69,4 +74,5 @@
6974
{% endfor %}
7075
</tbody>
7176
</table>
77+
{% endblock spacy_style %}
7278
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering other parameters section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
<p><strong>{{ section.title or "Other Parameters:" }}</strong></p>
45
<table>
56
<thead>
@@ -25,7 +26,9 @@
2526
{% endfor %}
2627
</tbody>
2728
</table>
29+
{% endblock table_style %}
2830
{% elif config.docstring_section_style == "list" %}
31+
{% block list_style %}
2932
<p>{{ section.title or "Other Parameters:" }}</p>
3033
<ul>
3134
{% for parameter in section.value %}
@@ -40,7 +43,9 @@
4043
</li>
4144
{% endfor %}
4245
</ul>
46+
{% endblock list_style %}
4347
{% elif config.docstring_section_style == "spacy" %}
48+
{% block spacy_style %}
4449
<table>
4550
<thead>
4651
<tr>
@@ -69,4 +74,5 @@
6974
{% endfor %}
7075
</tbody>
7176
</table>
77+
{% endblock spacy_style %}
7278
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering parameters section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
<p><strong>{{ section.title or "Parameters:" }}</strong></p>
45
<table>
56
<thead>
@@ -35,7 +36,9 @@
3536
{% endfor %}
3637
</tbody>
3738
</table>
39+
{% endblock table_style %}
3840
{% elif config.docstring_section_style == "list" %}
41+
{% block list_style %}
3942
<p>{{ section.title or "Parameters:" }}</p>
4043
<ul>
4144
{% for parameter in section.value %}
@@ -50,7 +53,9 @@
5053
</li>
5154
{% endfor %}
5255
</ul>
56+
{% endblock list_style %}
5357
{% elif config.docstring_section_style == "spacy" %}
58+
{% block spacy_style %}
5459
<table>
5560
<thead>
5661
<tr>
@@ -87,4 +92,5 @@
8792
{% endfor %}
8893
</tbody>
8994
</table>
95+
{% endblock spacy_style %}
9096
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering raises section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
<p><strong>{{ section.title or "Raises:" }}</strong></p>
45
<table>
56
<thead>
@@ -23,7 +24,9 @@
2324
{% endfor %}
2425
</tbody>
2526
</table>
27+
{% endblock table_style %}
2628
{% elif config.docstring_section_style == "list" %}
29+
{% block list_style %}
2730
<p>{{ section.title or "Raises:" }}</p>
2831
<ul>
2932
{% for raises in section.value %}
@@ -38,7 +41,9 @@
3841
</li>
3942
{% endfor %}
4043
</ul>
44+
{% endblock list_style %}
4145
{% elif config.docstring_section_style == "spacy" %}
46+
{% block spacy_style %}
4247
<table>
4348
<thead>
4449
<tr>
@@ -63,4 +68,5 @@
6368
{% endfor %}
6469
</tbody>
6570
</table>
71+
{% endblock spacy_style %}
6672
{% endif %}

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

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering receives section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
{% set name_column = section.value|selectattr("name")|any %}
45
<p><strong>{{ section.title or "Receives:" }}</strong></p>
56
<table>
@@ -26,7 +27,9 @@
2627
{% endfor %}
2728
</tbody>
2829
</table>
30+
{% endblock table_style %}
2931
{% elif config.docstring_section_style == "list" %}
32+
{% block list_style %}
3033
<p>{{ section.title or "Receives:" }}</p>
3134
<ul>
3235
{% for receives in section.value %}
@@ -43,7 +46,9 @@
4346
</li>
4447
{% endfor %}
4548
</ul>
49+
{% endblock list_style %}
4650
{% elif config.docstring_section_style == "spacy" %}
51+
{% block spacy_style %}
4752
<table>
4853
<thead>
4954
<tr>
@@ -82,4 +87,5 @@
8287
{% endfor %}
8388
</tbody>
8489
</table>
90+
{% endblock spacy_style %}
8591
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering returns section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
{% set name_column = section.value|selectattr("name")|any %}
45
<p><strong>{{ section.title or "Returns:" }}</strong></p>
56
<table>
@@ -26,7 +27,9 @@
2627
{% endfor %}
2728
</tbody>
2829
</table>
30+
{% endblock table_style %}
2931
{% elif config.docstring_section_style == "list" %}
32+
{% block list_style %}
3033
<p>{{ section.title or "Returns:" }}</p>
3134
<ul>
3235
{% for returns in section.value %}
@@ -43,7 +46,9 @@
4346
</li>
4447
{% endfor %}
4548
</ul>
49+
{% endblock list_style %}
4650
{% elif config.docstring_section_style == "spacy" %}
51+
{% block spacy_style %}
4752
<table>
4853
<thead>
4954
<tr>
@@ -82,4 +87,5 @@
8287
{% endfor %}
8388
</tbody>
8489
</table>
90+
{% endblock spacy_style %}
8591
{% endif %}

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

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering warns section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
<p><strong>{{ section.title or "Warns:" }}</strong></p>
45
<table>
56
<thead>
@@ -23,7 +24,9 @@
2324
{% endfor %}
2425
</tbody>
2526
</table>
27+
{% endblock table_style %}
2628
{% elif config.docstring_section_style == "list" %}
29+
{% block list_style %}
2730
<p>{{ section.title or "Warns:" }}</p>
2831
<ul>
2932
{% for warns in section.value %}
@@ -38,7 +41,9 @@
3841
</li>
3942
{% endfor %}
4043
</ul>
44+
{% endblock list_style %}
4145
{% elif config.docstring_section_style == "spacy" %}
46+
{% block spacy_style %}
4247
<table>
4348
<thead>
4449
<tr>
@@ -63,4 +68,5 @@
6368
{% endfor %}
6469
</tbody>
6570
</table>
71+
{% endblock spacy_style %}
6672
{% endif %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{ log.debug("Rendering yields section") }}
22
{% if config.docstring_section_style == "table" %}
3+
{% block table_style %}
34
{% set name_column = section.value|selectattr("name")|any %}
45
<p><strong>{{ section.title or "Yields:" }}</strong></p>
56
<table>
@@ -26,7 +27,9 @@
2627
{% endfor %}
2728
</tbody>
2829
</table>
30+
{% endblock table_style %}
2931
{% elif config.docstring_section_style == "list" %}
32+
{% block list_style %}
3033
<p>{{ section.title or "Yields:" }}</p>
3134
<ul>
3235
{% for yields in section.value %}
@@ -43,7 +46,9 @@
4346
</li>
4447
{% endfor %}
4548
</ul>
49+
{% endblock list_style %}
4650
{% elif config.docstring_section_style == "spacy" %}
51+
{% block spacy_style %}
4752
<table>
4853
<thead>
4954
<tr>
@@ -82,4 +87,5 @@
8287
{% endfor %}
8388
</tbody>
8489
</table>
90+
{% endblock spacy_style %}
8591
{% endif %}

0 commit comments

Comments
 (0)