Skip to content

Commit

Permalink
feat: Add Jinja blocks around docstring section styles
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Apr 29, 2022
1 parent 7e17fc4 commit aaa79ee
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering attributes section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
<p><strong>{{ section.title or "Attributes:" }}</strong></p>
<table>
<thead>
Expand All @@ -25,7 +26,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Attributes:" }}</p>
<ul>
{% for attribute in section.value %}
Expand All @@ -40,7 +43,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -69,4 +74,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering other parameters section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
<p><strong>{{ section.title or "Other Parameters:" }}</strong></p>
<table>
<thead>
Expand All @@ -25,7 +26,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Other Parameters:" }}</p>
<ul>
{% for parameter in section.value %}
Expand All @@ -40,7 +43,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -69,4 +74,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering parameters section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
<p><strong>{{ section.title or "Parameters:" }}</strong></p>
<table>
<thead>
Expand Down Expand Up @@ -35,7 +36,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Parameters:" }}</p>
<ul>
{% for parameter in section.value %}
Expand All @@ -50,7 +53,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -87,4 +92,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering raises section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
<p><strong>{{ section.title or "Raises:" }}</strong></p>
<table>
<thead>
Expand All @@ -23,7 +24,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Raises:" }}</p>
<ul>
{% for raises in section.value %}
Expand All @@ -38,7 +41,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand All @@ -63,4 +68,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering receives section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
<p><strong>{{ section.title or "Receives:" }}</strong></p>
<table>
Expand All @@ -26,7 +27,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Receives:" }}</p>
<ul>
{% for receives in section.value %}
Expand All @@ -43,7 +46,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -82,4 +87,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering returns section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
<p><strong>{{ section.title or "Returns:" }}</strong></p>
<table>
Expand All @@ -26,7 +27,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Returns:" }}</p>
<ul>
{% for returns in section.value %}
Expand All @@ -43,7 +46,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -82,4 +87,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering warns section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
<p><strong>{{ section.title or "Warns:" }}</strong></p>
<table>
<thead>
Expand All @@ -23,7 +24,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Warns:" }}</p>
<ul>
{% for warns in section.value %}
Expand All @@ -38,7 +41,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand All @@ -63,4 +68,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ log.debug("Rendering yields section") }}
{% if config.docstring_section_style == "table" %}
{% block table_style %}
{% set name_column = section.value|selectattr("name")|any %}
<p><strong>{{ section.title or "Yields:" }}</strong></p>
<table>
Expand All @@ -26,7 +27,9 @@
{% endfor %}
</tbody>
</table>
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style %}
<p>{{ section.title or "Yields:" }}</p>
<ul>
{% for yields in section.value %}
Expand All @@ -43,7 +46,9 @@
</li>
{% endfor %}
</ul>
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style %}
<table>
<thead>
<tr>
Expand Down Expand Up @@ -82,4 +87,5 @@
{% endfor %}
</tbody>
</table>
{% endblock spacy_style %}
{% endif %}

0 comments on commit aaa79ee

Please sign in to comment.