- {{ attribute.name }} |
+ {{ attribute.name }} |
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
@@ -40,7 +40,7 @@
{% for attribute in section.value %}
-
-
{{ attribute.name }}
+ {{ attribute.name }}
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
({% include "expression.html" with context %})
@@ -66,7 +66,7 @@
{% for attribute in section.value %}
- {{ attribute.name }} |
+ {{ attribute.name }} |
{{ attribute.description|convert_markdown(heading_level, html_id) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
index 62e0b3be..42531649 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
@@ -15,7 +15,7 @@
{% for class in section.value %}
- {{ class.name }} |
+ {{ class.name }} |
{{ class.description|convert_markdown(heading_level, html_id) }}
@@ -32,7 +32,7 @@
{% for class in section.value %}
-
-
{{ class.name }}
+ {{ class.name }}
–
{{ class.description|convert_markdown(heading_level, html_id) }}
@@ -53,7 +53,7 @@
{% for class in section.value %}
- {{ class.name }} |
+ {{ class.name }} |
{{ class.description|convert_markdown(heading_level, html_id) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
index 61b51a04..f93a2e4b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
@@ -16,7 +16,7 @@
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
- {{ function.name }} |
+ {{ function.name }} |
{{ function.description|convert_markdown(heading_level, html_id) }}
@@ -35,7 +35,7 @@
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
-
-
{{ function.name }}
+ {{ function.name }}
–
{{ function.description|convert_markdown(heading_level, html_id) }}
@@ -58,7 +58,7 @@
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
- {{ function.name }} |
+ {{ function.name }} |
{{ function.description|convert_markdown(heading_level, html_id) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
index b9e79d11..3bae2a83 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
@@ -15,7 +15,7 @@
{% for module in section.value %}
- {{ module.name }} |
+ {{ module.name }} |
{{ module.description|convert_markdown(heading_level, html_id) }}
@@ -32,7 +32,7 @@
{% for module in section.value %}
-
-
{{ module.name }}
+ {{ module.name }}
–
{{ module.description|convert_markdown(heading_level, html_id) }}
@@ -53,7 +53,7 @@
{% for module in section.value %}
- {{ module.name }} |
+ {{ module.name }} |
{{ module.description|convert_markdown(heading_level, html_id) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
index 341b0825..5c2ac29e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
@@ -16,16 +16,19 @@
{% endif %}
{% set function_name = function.path if show_full_path else function.name %}
+ {% set symbol_type = "method" if function.parent.is_class else "function" %}
{% if not root or config.show_root_heading %}
-
- {% filter heading(heading_level,
+ {% filter heading(
+ heading_level,
role="function",
id=html_id,
class="doc doc-heading",
- toc_label=function.name ~ "()") %}
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ ) %}
{% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
{% if config.separate_signature %}
{{ function_name }}
{% else %}
@@ -52,12 +55,15 @@
{% endblock signature %}
{% else %}
+
{% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
+ {% filter heading(
+ heading_level,
role="function",
id=html_id,
- toc_label=function.name,
- hidden=True) %}
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ hidden=True,
+ ) %}
{% endfilter %}
{% endif %}
{% set heading_level = heading_level - 1 %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
index dc44142b..7d45e321 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
@@ -16,14 +16,16 @@
{% set module_name = module.path if show_full_path else module.name %}
{% if not root or config.show_root_heading %}
-
- {% filter heading(heading_level,
+ {% filter heading(
+ heading_level,
role="module",
id=html_id,
class="doc doc-heading",
- toc_label=module.name) %}
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
+ ) %}
{% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
{% if config.separate_signature %}
{{ module_name }}
{% else %}
@@ -44,8 +46,9 @@
{% filter heading(heading_level,
role="module",
id=html_id,
- toc_label=module.name,
- hidden=True) %}
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
+ hidden=True,
+ ) %}
{% endfilter %}
{% endif %}
{% set heading_level = heading_level - 1 %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/templates/material/style.css b/src/mkdocstrings_handlers/python/templates/material/style.css
index f1da921a..82086b8f 100644
--- a/src/mkdocstrings_handlers/python/templates/material/style.css
+++ b/src/mkdocstrings_handlers/python/templates/material/style.css
@@ -25,39 +25,84 @@
float: right;
}
-/* Keep headings consistent. */
-h1.doc-heading,
-h2.doc-heading,
-h3.doc-heading,
-h4.doc-heading,
-h5.doc-heading,
-h6.doc-heading {
- font-weight: 400;
- line-height: 1.5;
- color: inherit;
- text-transform: none;
+/* Symbols in Navigation and ToC. */
+:root,
+[data-md-color-scheme="default"] {
+ --doc-symbol-attribute-fg-color: #953800;
+ --doc-symbol-function-fg-color: #8250df;
+ --doc-symbol-method-fg-color: #8250df;
+ --doc-symbol-class-fg-color: #0550ae;
+ --doc-symbol-module-fg-color: #5cad0f;
+
+ --doc-symbol-attribute-bg-color: #9538001a;
+ --doc-symbol-function-bg-color: #8250df1a;
+ --doc-symbol-method-bg-color: #8250df1a;
+ --doc-symbol-class-bg-color: #0550ae1a;
+ --doc-symbol-module-bg-color: #5cad0f1a;
+}
+
+[data-md-color-scheme="slate"] {
+ --doc-symbol-attribute-fg-color: #ffa657;
+ --doc-symbol-function-fg-color: #d2a8ff;
+ --doc-symbol-method-fg-color: #d2a8ff;
+ --doc-symbol-class-fg-color: #79c0ff;
+ --doc-symbol-module-fg-color: #baff79;
+
+ --doc-symbol-attribute-bg-color: #ffa6571a;
+ --doc-symbol-function-bg-color: #d2a8ff1a;
+ --doc-symbol-method-bg-color: #d2a8ff1a;
+ --doc-symbol-class-bg-color: #79c0ff1a;
+ --doc-symbol-module-bg-color: #baff791a;
+}
+
+code.doc-symbol {
+ border-radius: .1rem;
+ font-size: .85em;
+ padding: 0 .3em;
+ font-weight: bold;
+}
+
+code.doc-symbol-attribute {
+ color: var(--doc-symbol-attribute-fg-color);
+ background-color: var(--doc-symbol-attribute-bg-color);
+}
+
+code.doc-symbol-attribute::after {
+ content: "attr";
+}
+
+code.doc-symbol-function {
+ color: var(--doc-symbol-function-fg-color);
+ background-color: var(--doc-symbol-function-bg-color);
+}
+
+code.doc-symbol-function::after {
+ content: "func";
}
-h1.doc-heading {
- font-size: 1.6rem;
+code.doc-symbol-method {
+ color: var(--doc-symbol-method-fg-color);
+ background-color: var(--doc-symbol-method-bg-color);
}
-h2.doc-heading {
- font-size: 1.2rem;
+code.doc-symbol-method::after {
+ content: "meth";
}
-h3.doc-heading {
- font-size: 1.15rem;
+code.doc-symbol-class {
+ color: var(--doc-symbol-class-fg-color);
+ background-color: var(--doc-symbol-class-bg-color);
}
-h4.doc-heading {
- font-size: 1.10rem;
+code.doc-symbol-class::after {
+ content: "class";
}
-h5.doc-heading {
- font-size: 1.05rem;
+code.doc-symbol-module {
+ color: var(--doc-symbol-module-fg-color);
+ background-color: var(--doc-symbol-module-bg-color);
}
-h6.doc-heading {
- font-size: 1rem;
+code.doc-symbol-module::after {
+ content: "mod";
}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary.html b/src/mkdocstrings_handlers/python/templates/material/summary.html
new file mode 100644
index 00000000..6fccfa90
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary.html
@@ -0,0 +1 @@
+{% extends "_base/summary.html" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
new file mode 100644
index 00000000..e088b5fc
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
@@ -0,0 +1 @@
+{% extends "_base/summary/attributes.html" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
new file mode 100644
index 00000000..ab845ed5
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
@@ -0,0 +1 @@
+{% extends "_base/summary/classes.html" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
new file mode 100644
index 00000000..d5c6231b
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
@@ -0,0 +1 @@
+{% extends "_base/summary/functions.html" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
new file mode 100644
index 00000000..4765400f
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
@@ -0,0 +1 @@
+{% extends "_base/summary/modules.html" %}
From 36499eb87db7314c267861ecc7aeaac2a21cf656 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Mon, 8 Jan 2024 17:14:58 +0100
Subject: [PATCH 010/243] chore: Prepare release 1.8.0
---
CHANGELOG.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e4449d1..2c5647dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.8.0](https://github.com/mkdocstrings/python/releases/tag/1.8.0) - 2024-01-08
+
+[Compare with 1.7.5](https://github.com/mkdocstrings/python/compare/1.7.5...1.8.0)
+
+### Features
+
+- Release Insiders features of the $500/month funding goal ([bd30106](https://github.com/mkdocstrings/python/commit/bd301061fe9c647f9b91c2c9b4baa784c304eca7) by Timothée Mazzucotelli).
+ The features and projects related to *mkdocstrings-python* are:
+
+ - [Cross-references for type annotations in signatures](https://mkdocstrings.github.io/python/usage/configuration/signatures/#signature_crossrefs)
+ - [Symbol types in headings and table of contents](https://mkdocstrings.github.io/python/usage/configuration/headings/#show_symbol_type_toc)
+ - [`griffe-inherited-docstrings`](https://mkdocstrings.github.io/griffe-inherited-docstrings/), a Griffe extension for inheriting docstrings
+ - [`griffe2md`](https://mkdocstrings.github.io/griffe2md/), a tool to output API docs to Markdown using Griffe
+
+ See the complete list of features and projects here:
+ https://pawamoy.github.io/insiders/#500-plasmavac-user-guide.
+
## [1.7.5](https://github.com/mkdocstrings/python/releases/tag/1.7.5) - 2023-11-21
[Compare with 1.7.4](https://github.com/mkdocstrings/python/compare/1.7.4...1.7.5)
From 4fe186f1002395d398cb386bb6914fdb497d7c80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Mon, 8 Jan 2024 17:47:05 +0100
Subject: [PATCH 011/243] chore: Template upgrade
---
.copier-answers.yml | 2 +-
Makefile | 1 +
scripts/insiders.py | 2 +-
scripts/setup.sh | 7 +++++++
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/.copier-answers.yml b/.copier-answers.yml
index 58ab94af..d8a0fef0 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
-_commit: 1.1.3
+_commit: 1.2.0
_src_path: gh:pawamoy/copier-pdm
author_email: pawamoy@pm.me
author_fullname: Timothée Mazzucotelli
diff --git a/Makefile b/Makefile
index 437880eb..8ad5209e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
SHELL := bash
DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11 3.12
+export PDM_MULTIRUN_USE_VENVS ?= $(if $(shell pdm config python.use_venv | grep True),1,0)
args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
check_quality_args = files
diff --git a/scripts/insiders.py b/scripts/insiders.py
index 8f5e215e..85ecbd0e 100644
--- a/scripts/insiders.py
+++ b/scripts/insiders.py
@@ -155,7 +155,7 @@ def funding_goals(source: str | list[str | tuple[str, str, str]], funding: int =
return _load_goals_from_disk(source, funding)
goals = {}
for src in source:
- source_goals = _load_goals(src)
+ source_goals = _load_goals(src, funding)
for amount, goal in source_goals.items():
if amount not in goals:
goals[amount] = goal
diff --git a/scripts/setup.sh b/scripts/setup.sh
index bbf0d11d..eef38433 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -12,6 +12,13 @@ if ! pdm self list 2>/dev/null | grep -q pdm-multirun; then
fi
if [ -n "${PDM_MULTIRUN_VERSIONS}" ]; then
+ if [ "${PDM_MULTIRUN_USE_VENVS}" -eq "1" ]; then
+ for version in ${PDM_MULTIRUN_VERSIONS}; do
+ if ! pdm venv --path "${version}" &>/dev/null; then
+ pdm venv create --name "${version}" "${version}"
+ fi
+ done
+ fi
pdm multirun -v pdm install -G:all
else
pdm install -G:all
From 03e53e3964908d77068ed7d8538a046222b56d55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Tue, 9 Jan 2024 15:56:45 +0100
Subject: [PATCH 012/243] docs: Tell that members are still grouped by category
when specifying members or members order options
Issue #119: https://github.com/mkdocstrings/python/issues/119
---
docs/usage/configuration/members.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md
index 0b6d27e5..f558040f 100644
--- a/docs/usage/configuration/members.md
+++ b/docs/usage/configuration/members.md
@@ -14,6 +14,8 @@ even if [`show_if_no_docstring`][] is set to false.
The members will be rendered in the specified order,
regardless of the value of [`members_order`][].
+**Note that members will still be grouped by category,
+according to the [`group_by_category`][] option.**
Passing a falsy value (`no`, `false` in YAML) or an empty list (`[]`)
will tell the Python handler not to render any member.
@@ -269,6 +271,8 @@ The members ordering to use. Possible values:
The order applies for all members, recursively.
The order will be ignored for members that are explicitely sorted using the [`members`][] option.
+**Note that members will still be grouped by category,
+according to the [`group_by_category`][] option.**
```yaml title="in mkdocs.yml (global configuration)"
plugins:
From d70cd9d6e592e545b2c4e1d6964a927df0fcb7d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 31 Jan 2024 12:32:16 +0100
Subject: [PATCH 013/243] docs: Fix typo
---
docs/usage/customization.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/usage/customization.md b/docs/usage/customization.md
index 9dedbf20..14721092 100644
--- a/docs/usage/customization.md
+++ b/docs/usage/customization.md
@@ -324,7 +324,7 @@ Available context:
Available context:
- `config`: The handler configuration (dictionary).
-- `function`: The [Attribute][griffe.dataclasses.Attribute] instance.
+- `attribute`: The [Attribute][griffe.dataclasses.Attribute] instance.
#### Docstring sections
From 548bdaddd66ffc99b3b9a5a62228a2ff4ff0dd00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 31 Jan 2024 12:32:37 +0100
Subject: [PATCH 014/243] refactor: Mark all Jinja blocks as scoped
---
.../templates/material/_base/docstring/attributes.html | 6 +++---
.../python/templates/material/_base/docstring/classes.html | 6 +++---
.../templates/material/_base/docstring/functions.html | 6 +++---
.../python/templates/material/_base/docstring/modules.html | 6 +++---
.../material/_base/docstring/other_parameters.html | 6 +++---
.../templates/material/_base/docstring/parameters.html | 6 +++---
.../python/templates/material/_base/docstring/raises.html | 6 +++---
.../python/templates/material/_base/docstring/receives.html | 6 +++---
.../python/templates/material/_base/docstring/returns.html | 6 +++---
.../python/templates/material/_base/docstring/warns.html | 6 +++---
.../python/templates/material/_base/docstring/yields.html | 6 +++---
11 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
index 0b291574..88c5990d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Attributes:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Attributes:") }}
{% for attribute in section.value %}
@@ -55,7 +55,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
index 42531649..b8ad2e0f 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Classes:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Classes:") }}
{% for class in section.value %}
@@ -42,7 +42,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
index f93a2e4b..ab1939f5 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
{% for function in section.value %}
@@ -46,7 +46,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
index 3bae2a83..f771f20b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Modules:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Modules:") }}
{% for module in section.value %}
@@ -42,7 +42,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
index 8315381d..7ede6715 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Other Parameters:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Other Parameters:") }}
{% for parameter in section.value %}
@@ -55,7 +55,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
index 9483e8af..7b4788ca 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Parameters:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Parameters:") }}
{% for parameter in section.value %}
@@ -70,7 +70,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
index e4edc66a..396ccc73 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Raises:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ lang.t(section.title) or lang.t("Raises:") }}
{% for raises in section.value %}
@@ -52,7 +52,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
index d58fb684..77d83c0b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
{{ section.title or lang.t("Receives:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Receives:") }}
{% for receives in section.value %}
@@ -58,7 +58,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
index a8e3b776..b19917a3 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
{{ section.title or lang.t("Returns:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Returns:") }}
{% for returns in section.value %}
@@ -58,7 +58,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
index cf1cc4a6..8377669f 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{{ section.title or lang.t("Warns:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Warns:") }}
{% for warns in section.value %}
@@ -52,7 +52,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
index 63824c0c..c69135ea 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
@@ -3,7 +3,7 @@
{% import "language.html" as lang with context %}
{% if config.docstring_section_style == "table" %}
- {% block table_style %}
+ {% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
{{ section.title or lang.t("Yields:") }}
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
- {% block list_style %}
+ {% block list_style scoped %}
{{ section.title or lang.t("Yields:") }}
{% for yields in section.value %}
@@ -58,7 +58,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style %}
+ {% block spacy_style scoped %}
From 0c6aa323c9e57b8348765a5daa11c79d0c5edb07 Mon Sep 17 00:00:00 2001
From: Romain
Date: Sat, 3 Feb 2024 05:40:36 -0800
Subject: [PATCH 015/243] feat: Add option to search for stubs packages
This allows using the feature in Griffe that searches for stubs packages.
PR #128: https://github.com/mkdocstrings/python/pull/128
PR griffe#221: : https://github.com/mkdocstrings/griffe/pull/221
---
docs/usage/configuration/general.md | 57 +++++++++++++++++++++
src/mkdocstrings_handlers/python/handler.py | 6 ++-
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/docs/usage/configuration/general.md b/docs/usage/configuration/general.md
index 320d0074..e4ddaec1 100644
--- a/docs/usage/configuration/general.md
+++ b/docs/usage/configuration/general.md
@@ -191,3 +191,60 @@ __all__ = ["their_object"]
Docstring of your module.
////
///
+
+## `find_stubs_package`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+When looking for documentation specified in [autodoc instructions][autodoc syntax] (`::: identifier`), also look for
+the stubs package as defined in [PEP 561](https://peps.python.org/pep-0561/) if it exists. This is useful when
+most of your documentation is separately provided by such a package and not inline in your main package.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ find_stubs_package: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: your_package.your_module.your_func
+ options:
+ find_stubs_package: true
+```
+
+```python title="your_package/your_module.py"
+
+def your_func(a, b):
+ # Function code
+ ...
+
+# rest of your code
+```
+
+```python title="your_package-stubs/your_module.pyi"
+
+def your_func(a: int, b: str):
+ """
+
+ """
+ ...
+
+# rest of your code
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With find_stubs_package
+your_func
+Function docstring
+////
+
+//// tab | Without find_stubs_package
+your_func
+////
+///
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 9f6cae4b..7b33e30c 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -61,6 +61,7 @@ class PythonHandler(BaseHandler):
fallback_config: ClassVar[dict] = {"fallback": True}
"""The configuration used to collect item during autorefs fallback."""
default_config: ClassVar[dict] = {
+ "find_stubs_package": False,
"docstring_style": "google",
"docstring_options": {},
"show_symbol_type_heading": False,
@@ -110,6 +111,7 @@ class PythonHandler(BaseHandler):
"""Default handler configuration.
Attributes: General options:
+ find_stubs_package (bool): Whether to load stubs package (package-stubs) when extracting docstrings.
allow_inspection (bool): Whether to allow inspecting modules when visiting them is not possible. Default: `True`.
show_bases (bool): Show the base classes of a class. Default: `True`.
show_source (bool): Show the source code of this object. Default: `True`.
@@ -279,8 +281,8 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> CollectorItem:
try:
for pre_loaded_module in final_config.get("preload_modules") or []:
if pre_loaded_module not in self._modules_collection:
- loader.load(pre_loaded_module)
- loader.load(module_name)
+ loader.load(pre_loaded_module, find_stubs_package=final_config["find_stubs_package"])
+ loader.load(module_name, find_stubs_package=final_config["find_stubs_package"])
except ImportError as error:
raise CollectionError(str(error)) from error
unresolved, iterations = loader.resolve_aliases(
From 8e867785574536cf085496ef32647b5ad2b1b517 Mon Sep 17 00:00:00 2001
From: Romain
Date: Sun, 4 Feb 2024 02:35:40 -0800
Subject: [PATCH 016/243] docs: Add default value for `find_stubs_package` docs
---
src/mkdocstrings_handlers/python/handler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 7b33e30c..7ffdaf6b 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -111,7 +111,7 @@ class PythonHandler(BaseHandler):
"""Default handler configuration.
Attributes: General options:
- find_stubs_package (bool): Whether to load stubs package (package-stubs) when extracting docstrings.
+ find_stubs_package (bool): Whether to load stubs package (package-stubs) when extracting docstrings. Default `False`.
allow_inspection (bool): Whether to allow inspecting modules when visiting them is not possible. Default: `True`.
show_bases (bool): Show the base classes of a class. Default: `True`.
show_source (bool): Show the source code of this object. Default: `True`.
From eaf9b8240069f7369f401fe048892043c8b173d3 Mon Sep 17 00:00:00 2001
From: Viicos <65306057+Viicos@users.noreply.github.com>
Date: Mon, 5 Feb 2024 13:47:05 +0100
Subject: [PATCH 017/243] feat: Add `show_labels` option to show/hide labels
Issue #120: https://github.com/mkdocstrings/python/issues/120
PR #130: https://github.com/mkdocstrings/python/pull/130
---
docs/usage/configuration/members.md | 46 +++++++++++++++++++
src/mkdocstrings_handlers/python/handler.py | 2 +
.../templates/material/_base/labels.html | 2 +-
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md
index f558040f..1e5ff771 100644
--- a/docs/usage/configuration/members.md
+++ b/docs/usage/configuration/members.md
@@ -643,3 +643,49 @@ plugins:
////
///
+
+## `show_labels`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
+
+
+Whether to show labels of the members.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_labels: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ show_labels: false
+```
+
+```python title="package/module.py"
+class SomeClass:
+ some_attr: int
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With labels
+
+ some_attr:
+ int
+
+instance-attribute
+////
+
+//// tab | Without labels
+
+ some_attr:
+ int
+
+////
+///
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 7ffdaf6b..c5217e98 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -106,6 +106,7 @@ class PythonHandler(BaseHandler):
"preload_modules": None,
"allow_inspection": True,
"summary": False,
+ "show_labels": True,
"unwrap_annotated": False,
}
"""Default handler configuration.
@@ -154,6 +155,7 @@ class PythonHandler(BaseHandler):
group_by_category (bool): Group the object's children by categories: attributes, classes, functions, and modules. Default: `True`.
show_submodules (bool): When rendering a module, show its submodules recursively. Default: `False`.
summary (bool | dict[str, bool]): Whether to render summaries of modules, classes, functions (methods) and attributes.
+ show_labels (bool): Whether to show labels of the members. Default: `True`.
Attributes: Docstrings options:
docstring_style (str): The docstring style to use: `google`, `numpy`, `sphinx`, or `None`. Default: `"google"`.
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
index 0c84067a..a35bffbb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
@@ -1,4 +1,4 @@
-{% if labels %}
+{% if config.show_labels and labels %}
{{ log.debug("Rendering labels") }}
{% for label in labels|sort %}
From 6364fbcd4012d2026aa9efe4501b697f08b8c6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 19:34:04 +0100
Subject: [PATCH 018/243] chore: Template upgrade
---
.copier-answers.yml | 7 +++---
.github/workflows/ci.yml | 8 +++----
.github/workflows/release.yml | 4 ++--
.gitignore | 1 +
CODE_OF_CONDUCT.md | 2 +-
config/ruff.toml | 6 ++++-
config/vscode/launch.json | 4 ++--
docs/insiders/index.md | 44 +++++++++++++++++++++++------------
docs/insiders/installation.md | 4 ++--
docs/js/insiders.js | 39 ++++++++++++++++++-------------
duties.py | 4 ++--
pyproject.toml | 2 +-
scripts/gen_ref_nav.py | 5 ++--
13 files changed, 79 insertions(+), 51 deletions(-)
diff --git a/.copier-answers.yml b/.copier-answers.yml
index d8a0fef0..dd37bf57 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,14 +1,15 @@
# Changes here will be overwritten by Copier
-_commit: 1.2.0
+_commit: 1.2.6
_src_path: gh:pawamoy/copier-pdm
-author_email: pawamoy@pm.me
+author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
copyright_date: '2021'
copyright_holder: Timothée Mazzucotelli
-copyright_holder_email: pawamoy@pm.me
+copyright_holder_email: dev@pawamoy.fr
copyright_license: ISC License
insiders: true
+insiders_email: insiders@pawamoy.fr
insiders_repository_name: mkdocstrings-python
project_description: A Python handler for mkdocstrings.
project_name: mkdocstrings-python
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a1d63df6..be76a509 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,13 +23,13 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --depth=1 --tags
- name: Set up PDM
- uses: pdm-project/setup-pdm@v3
+ uses: pdm-project/setup-pdm@v4
with:
python-version: "3.8"
@@ -96,10 +96,10 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Set up PDM
- uses: pdm-project/setup-pdm@v3
+ uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3dcc3fe4..d82736f7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -10,7 +10,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --depth=1 --tags
- name: Setup Python
@@ -22,7 +22,7 @@ jobs:
if: github.repository_owner == 'pawamoy-insiders'
run: python -m build
- name: Upload dists artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: github.repository_owner == 'pawamoy-insiders'
with:
name: python-insiders
diff --git a/.gitignore b/.gitignore
index ae47b28b..588e34e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.idea/
+.vscode/
__pycache__/
*.py[cod]
dist/
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index fe3eefbf..255e0eed 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
-pawamoy@pm.me.
+dev@pawamoy.fr.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
diff --git a/config/ruff.toml b/config/ruff.toml
index 99efa62b..a16c92b6 100644
--- a/config/ruff.toml
+++ b/config/ruff.toml
@@ -1,5 +1,5 @@
target-version = "py38"
-line-length = 132
+line-length = 120
exclude = [
"fixtures",
"site",
@@ -102,3 +102,7 @@ known-first-party = ["mkdocstrings_handlers"]
[pydocstyle]
convention = "google"
+
+[format]
+docstring-code-format = true
+docstring-code-line-length = 80
diff --git a/config/vscode/launch.json b/config/vscode/launch.json
index 2e0d651e..d056ccee 100644
--- a/config/vscode/launch.json
+++ b/config/vscode/launch.json
@@ -3,7 +3,7 @@
"configurations": [
{
"name": "python (current file)",
- "type": "python",
+ "type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
@@ -11,7 +11,7 @@
},
{
"name": "test",
- "type": "python",
+ "type": "debugpy",
"request": "launch",
"module": "pytest",
"justMyCode": false,
diff --git a/docs/insiders/index.md b/docs/insiders/index.md
index ceb3c59c..a6642ede 100644
--- a/docs/insiders/index.md
+++ b/docs/insiders/index.md
@@ -65,17 +65,31 @@ data_source = [
```
-```python exec="1" session="insiders"
+```python exec="1" session="insiders" idprefix=""
--8<-- "scripts/insiders.py"
-print(
- f"""The moment you become a sponsor, you'll get **immediate
- access to {len(unreleased_features)} additional features** that you can start using right away, and
- which are currently exclusively available to sponsors:\n"""
-)
-
-for feature in unreleased_features:
- feature.render(badge=True)
+if unreleased_features:
+ print(
+ "The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get **immediate "
+ f"access to {len(unreleased_features)} additional features** that you can start using right away, and "
+ "which are currently exclusively available to sponsors:\n"
+ )
+
+ for feature in unreleased_features:
+ feature.render(badge=True)
+
+ print(
+ "\n\nThese are just the features related to this project. "
+ "[See the complete feature list on the author's main Insiders page](https://pawamoy.github.io/insiders/#whats-in-it-for-me)."
+ )
+else:
+ print(
+ "The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get immediate "
+ "access to all released features that you can start using right away, and "
+ "which are exclusively available to sponsors. At this moment, there are no "
+ "Insiders features for this project, but checkout the [next funding goals](#goals) "
+ "to see what's coming, as well as **[the feature list for all Insiders projects](https://pawamoy.github.io/insiders/#whats-in-it-for-me).**"
+ )
```
@@ -88,7 +102,7 @@ You can use your individual or organization GitHub account for sponsoring.
**Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
through a GitHub organization, please send a short email
-to pawamoy@pm.me with the name of your
+to insiders@pawamoy.fr with the name of your
organization and the GitHub account of the individual
that should be added as a collaborator.[^4]
@@ -97,7 +111,7 @@ You can cancel your sponsorship anytime.[^5]
[^4]:
It's currently not possible to grant access to each member of an
organization, as GitHub only allows for adding users. Thus, after
- sponsoring, please send an email to pawamoy@pm.me, stating which
+ sponsoring, please send an email to insiders@pawamoy.fr, stating which
account should become a collaborator of the Insiders repository. We're
working on a solution which will make access to organizations much simpler.
To ensure that access is not tied to a particular individual GitHub account,
@@ -120,10 +134,10 @@ You can cancel your sponsorship anytime.[^5]
-
@@ -188,7 +202,7 @@ yearly billing cycle][billing cycle]. If for some reason you cannot do that, you
could also create a dedicated GitHub account with a yearly billing cycle, which
you only use for sponsoring (some sponsors already do that).
-If you have any problems or further questions, please reach out to pawamoy@pm.me.
+If you have any problems or further questions, please reach out to insiders@pawamoy.fr.
### Terms
diff --git a/docs/insiders/installation.md b/docs/insiders/installation.md
index 3d9d75d8..3ebe5dfd 100644
--- a/docs/insiders/installation.md
+++ b/docs/insiders/installation.md
@@ -143,7 +143,7 @@ as it is against our [Terms of use](index.md#terms).**
> ```bash
> # clone the repository
> git clone git@github.com:pawamoy-insiders/mkdocstrings-python
-> cd python
+> cd mkdocstrings-python
>
> # install build
> pip install --user build
@@ -184,7 +184,7 @@ git clone git@github.com:pawamoy-insiders/mkdocstrings-python
When cloning from `git`, the package must be installed:
```
-pip install -e python
+pip install -e mkdocstrings-python
```
## Upgrading
diff --git a/docs/js/insiders.js b/docs/js/insiders.js
index 03bcb404..8bb68485 100644
--- a/docs/js/insiders.js
+++ b/docs/js/insiders.js
@@ -21,6 +21,26 @@ function getJSON(url, callback) {
xhr.send();
}
+function updatePremiumSponsors(dataURL, rank) {
+ let capRank = rank.charAt(0).toUpperCase() + rank.slice(1);
+ getJSON(dataURL + `/sponsors${capRank}.json`, function (err, sponsors) {
+ const sponsorsDiv = document.getElementById(`${rank}-sponsors`);
+ if (sponsors.length > 0) {
+ let html = '';
+ html += `${capRank} sponsors`
+ sponsors.forEach(function (sponsor) {
+ html += `
+
+
+
+ `
+ });
+ html += ' '
+ sponsorsDiv.innerHTML = html;
+ }
+ });
+}
+
function updateInsidersPage(author_username) {
const sponsorURL = `https://github.com/sponsors/${author_username}`
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
@@ -48,20 +68,7 @@ function updateInsidersPage(author_username) {
}
});
});
- getJSON(dataURL + '/sponsorsBronze.json', function (err, sponsors) {
- const bronzeSponsors = document.getElementById("bronze-sponsors");
- if (sponsors) {
- let html = '';
- html += 'Bronze sponsors'
- sponsors.forEach(function (sponsor) {
- html += `
-
-
-
- `
- });
- html += ' '
- bronzeSponsors.innerHTML = html;
- }
- });
+ updatePremiumSponsors(dataURL, "gold");
+ updatePremiumSponsors(dataURL, "silver");
+ updatePremiumSponsors(dataURL, "bronze");
}
diff --git a/duties.py b/duties.py
index 30fb2221..55fcf6a2 100644
--- a/duties.py
+++ b/duties.py
@@ -10,7 +10,7 @@
from typing import TYPE_CHECKING, Iterator
from duty import duty
-from duty.callables import black, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
+from duty.callables import coverage, lazy, mkdocs, mypy, pytest, ruff, safety
if TYPE_CHECKING:
from duty.context import Context
@@ -225,7 +225,7 @@ def format(ctx: Context) -> None:
ruff.check(*PY_SRC_LIST, config="config/ruff.toml", fix_only=True, exit_zero=True),
title="Auto-fixing code",
)
- ctx.run(black.run(*PY_SRC_LIST, config="config/black.toml"), title="Formatting code")
+ ctx.run(ruff.format(*PY_SRC_LIST, config="config/ruff.toml"), title="Formatting code")
@duty(post=["docs-deploy"])
diff --git a/pyproject.toml b/pyproject.toml
index 853cdf9e..75643e9a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,7 @@ build-backend = "pdm.backend"
[project]
name = "mkdocstrings-python"
description = "A Python handler for mkdocstrings."
-authors = [{name = "Timothée Mazzucotelli", email = "pawamoy@pm.me"}]
+authors = [{name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr"}]
license = {text = "ISC"}
readme = "README.md"
requires-python = ">=3.8"
diff --git a/scripts/gen_ref_nav.py b/scripts/gen_ref_nav.py
index 7285ac1c..b369536c 100644
--- a/scripts/gen_ref_nav.py
+++ b/scripts/gen_ref_nav.py
@@ -7,7 +7,8 @@
nav = mkdocs_gen_files.Nav()
mod_symbol = ''
-src = Path(__file__).parent.parent / "src"
+root = Path(__file__).parent.parent
+src = root / "src"
for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
@@ -30,7 +31,7 @@
ident = ".".join(parts)
fd.write(f"::: {ident}")
- mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path)
+ mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
From 0dd0b7956bc2db2e492404cb5a445ad49f126a9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 19:35:36 +0100
Subject: [PATCH 019/243] chore: Use mkdocstrings' handler-template
---
.copier-answers.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.copier-answers.yml b/.copier-answers.yml
index dd37bf57..65d4018a 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,6 +1,6 @@
# Changes here will be overwritten by Copier
-_commit: 1.2.6
-_src_path: gh:pawamoy/copier-pdm
+_commit: 0.1.0
+_src_path: gh:mkdocstrings/handler-template
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
@@ -20,4 +20,4 @@ python_package_import_name: mkdocstrings_handlers
repository_name: python
repository_namespace: mkdocstrings
repository_provider: github.com
-
+language: Python
\ No newline at end of file
From 20623257d0b98d843b68f8bd168e551a8c98b10d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 19:49:01 +0100
Subject: [PATCH 020/243] chore: Template upgrade
---
.copier-answers.yml | 8 +-
.envrc | 1 +
.github/workflows/ci.yml | 61 +++++--
.gitignore | 7 +-
.gitpod.dockerfile | 2 +-
CONTRIBUTING.md | 10 +-
Makefile | 57 ++-----
README.md | 22 +--
config/coverage.ini | 3 +-
config/pytest.ini | 6 -
config/ruff.toml | 64 +++-----
config/vscode/launch.json | 11 ++
config/vscode/settings.json | 23 +--
config/vscode/tasks.json | 80 +++++----
devdeps.txt | 27 +++
docs/insiders/goals.yml | 8 +-
docs/insiders/index.md | 7 +-
duties.py | 21 ++-
pyproject.toml | 44 -----
scripts/gen_credits.py | 150 +++++++++++------
scripts/insiders.py | 16 +-
scripts/make | 155 ++++++++++++++++++
scripts/setup.sh | 25 ---
src/mkdocstrings_handlers/python/__init__.py | 6 +-
.../{ => python}/py.typed | 0
tests/conftest.py | 6 +-
tests/test_themes.py | 13 +-
27 files changed, 483 insertions(+), 350 deletions(-)
create mode 100644 .envrc
create mode 100644 devdeps.txt
create mode 100755 scripts/make
delete mode 100755 scripts/setup.sh
rename src/mkdocstrings_handlers/{ => python}/py.typed (100%)
diff --git a/.copier-answers.yml b/.copier-answers.yml
index 65d4018a..0e3a987e 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
-_commit: 0.1.0
+_commit: 0.3.1
_src_path: gh:mkdocstrings/handler-template
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
@@ -11,13 +11,13 @@ copyright_license: ISC License
insiders: true
insiders_email: insiders@pawamoy.fr
insiders_repository_name: mkdocstrings-python
+language: Python
project_description: A Python handler for mkdocstrings.
project_name: mkdocstrings-python
public_release: true
-python_package_command_line_name: ''
python_package_distribution_name: mkdocstrings-python
-python_package_import_name: mkdocstrings_handlers
+python_package_import_name: python
repository_name: python
repository_namespace: mkdocstrings
repository_provider: github.com
-language: Python
\ No newline at end of file
+
diff --git a/.envrc b/.envrc
new file mode 100644
index 00000000..f9d77ee3
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+PATH_add scripts
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index be76a509..f3b59817 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,7 @@ env:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
PYTHONIOENCODING: UTF-8
+ PYTHON_VERSIONS: ""
jobs:
@@ -28,28 +29,51 @@ jobs:
- name: Fetch all tags
run: git fetch --depth=1 --tags
- - name: Set up PDM
- uses: pdm-project/setup-pdm@v4
+ - name: Set up Python
+ uses: actions/setup-python@v5
with:
- python-version: "3.8"
+ python-version: "3.11"
- - name: Resolving dependencies
- run: pdm lock -v --no-cross-platform -G ci-quality
+ - name: Install uv
+ run: pip install uv
- name: Install dependencies
- run: pdm install -G ci-quality
+ run: make setup
- name: Check if the documentation builds correctly
- run: pdm run duty check-docs
+ run: make check-docs
- name: Check the code quality
- run: pdm run duty check-quality
+ run: make check-quality
- name: Check if the code is correctly typed
- run: pdm run duty check-types
+ run: make check-types
- name: Check for vulnerabilities in dependencies
- run: pdm run duty check-dependencies
+ run: make check-dependencies
+
+ - name: Check for breaking changes in the API
+ run: make check-api
+
+ exclude-test-jobs:
+ runs-on: ubuntu-latest
+ outputs:
+ jobs: ${{ steps.exclude-jobs.outputs.jobs }}
+ steps:
+ - id: exclude-jobs
+ run: |
+ if ${{ github.repository_owner == 'pawamoy-insiders' }}; then
+ echo 'jobs=[
+ {"os": "macos-latest"},
+ {"os": "windows-latest"},
+ {"python-version": "3.9"},
+ {"python-version": "3.10"},
+ {"python-version": "3.11"},
+ {"python-version": "3.12"}
+ ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
+ else
+ echo 'jobs=[]' >> $GITHUB_OUTPUT
+ fi
- name: Check for breaking changes in the API
run: pdm run duty check-api
@@ -98,17 +122,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- - name: Set up PDM
- uses: pdm-project/setup-pdm@v4
+ - name: Set up Python
+ uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- allow-python-prereleases: true
+ allow-prereleases: true
- - name: Resolving dependencies
- run: pdm lock -v --no-cross-platform -G ci-tests
+ - name: Install uv
+ run: pip install uv
- name: Install dependencies
- run: pdm install --no-editable -G ci-tests
+ run: |
+ uv venv
+ uv pip install -r devdeps.txt
+ uv pip install "mkdocstrings-python @ ."
- name: Run the test suite
- run: pdm run duty test
+ run: make test
diff --git a/.gitignore b/.gitignore
index 588e34e0..246951cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,11 +10,8 @@ htmlcov/
pip-wheel-metadata/
.pytest_cache/
.mypy_cache/
+.ruff_cache/
site/
-pdm.lock
-pdm.toml
-.pdm-plugins/
-.pdm-python
-__pypackages__/
.venv/
+.venvs/
.cache/
diff --git a/.gitpod.dockerfile b/.gitpod.dockerfile
index 0e6d9d35..1590b415 100644
--- a/.gitpod.dockerfile
+++ b/.gitpod.dockerfile
@@ -2,5 +2,5 @@ FROM gitpod/workspace-full
USER gitpod
ENV PIP_USER=no
RUN pip3 install pipx; \
- pipx install pdm; \
+ pipx install uv; \
pipx ensurepath
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index dfe5a910..6af01962 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,18 +17,18 @@ make setup
> NOTE:
> If it fails for some reason,
> you'll need to install
-> [PDM](https://github.com/pdm-project/pdm)
+> [uv](https://github.com/astral-sh/uv)
> manually.
>
> You can install it with:
>
> ```bash
> python3 -m pip install --user pipx
-> pipx install pdm
+> pipx install uv
> ```
>
> Now you can try running `make setup` again,
-> or simply `pdm install`.
+> or simply `uv install`.
You now have the dependencies installed.
@@ -39,13 +39,13 @@ Run `make help` to see all the available actions!
This project uses [duty](https://github.com/pawamoy/duty) to run tasks.
A Makefile is also provided. The Makefile will try to run certain tasks
on multiple Python versions. If for some reason you don't want to run the task
-on multiple Python versions, you run the task directly with `pdm run duty TASK`.
+on multiple Python versions, you run the task directly with `make run duty TASK`.
The Makefile detects if a virtual environment is activated,
so `make` will work the same with the virtualenv activated or not.
If you work in VSCode, we provide
-[an action to configure VSCode](https://pawamoy.github.io/copier-pdm/work/#vscode-setup)
+[an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup)
for the project.
## Development
diff --git a/Makefile b/Makefile
index 8ad5209e..771b333c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,27 @@
-.DEFAULT_GOAL := help
-SHELL := bash
-DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
-export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11 3.12
-export PDM_MULTIRUN_USE_VENVS ?= $(if $(shell pdm config python.use_venv | grep True),1,0)
+# If you have `direnv` loaded in your shell, and allow it in the repository,
+# the `make` command will point at the `scripts/make` shell script.
+# This Makefile is just here to allow auto-completion in the terminal.
-args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
-check_quality_args = files
-docs_args = host port
-release_args = version
-test_args = match
-
-BASIC_DUTIES = \
+actions = \
changelog \
+ check \
check-api \
check-dependencies \
+ check-docs \
+ check-quality \
+ check-types \
clean \
coverage \
docs \
docs-deploy \
format \
+ help \
release \
+ run \
+ setup \
+ test \
vscode
-QUALITY_DUTIES = \
- check-quality \
- check-docs \
- check-types \
- test
-
-.PHONY: help
-help:
- @$(DUTY) --list
-
-.PHONY: lock
-lock:
- @pdm lock -G:all
-
-.PHONY: setup
-setup:
- @bash scripts/setup.sh
-
-.PHONY: check
-check:
- @pdm multirun duty check-quality check-types check-docs
- @$(DUTY) check-dependencies check-api
-
-.PHONY: $(BASIC_DUTIES)
-$(BASIC_DUTIES):
- @$(DUTY) $@ $(call args,$@)
-
-.PHONY: $(QUALITY_DUTIES)
-$(QUALITY_DUTIES):
- @pdm multirun duty $@ $(call args,$@)
+.PHONY: $(actions)
+$(actions):
+ @bash scripts/make "$@"
diff --git a/README.md b/README.md
index 6b3afb5f..23b6e809 100644
--- a/README.md
+++ b/README.md
@@ -2,23 +2,11 @@
A Python handler for mkdocstrings.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+[](https://github.com/mkdocstrings/python/actions?query=workflow%3Aci)
+[](https://mkdocstrings.github.io/python/)
+[](https://pypi.org/project/mkdocstrings-python/)
+[](https://gitpod.io/#https://github.com/mkdocstrings/python)
+[](https://app.gitter.im/#/room/#python:gitter.im)
---
diff --git a/config/coverage.ini b/config/coverage.ini
index 19b34d9b..71d12074 100644
--- a/config/coverage.ini
+++ b/config/coverage.ini
@@ -8,7 +8,8 @@ source =
[coverage:paths]
equivalent =
src/
- __pypackages__/
+ .venv/lib/*/site-packages/
+ .venvs/*/lib/*/site-packages/
[coverage:report]
include_namespace_packages = true
diff --git a/config/pytest.ini b/config/pytest.ini
index 5a493959..ebdeb484 100644
--- a/config/pytest.ini
+++ b/config/pytest.ini
@@ -1,10 +1,4 @@
[pytest]
-norecursedirs =
- .git
- .tox
- .env
- dist
- build
python_files =
test_*.py
*_test.py
diff --git a/config/ruff.toml b/config/ruff.toml
index a16c92b6..751bf595 100644
--- a/config/ruff.toml
+++ b/config/ruff.toml
@@ -1,53 +1,27 @@
target-version = "py38"
line-length = 120
+
+[lint]
exclude = [
"fixtures",
"site",
]
select = [
- "A",
- "ANN",
- "ARG",
- "B",
- "BLE",
- "C",
- "C4",
+ "A", "ANN", "ARG",
+ "B", "BLE",
+ "C", "C4",
"COM",
- "D",
- "DTZ",
- "E",
- "ERA",
- "EXE",
- "F",
- "FBT",
+ "D", "DTZ",
+ "E", "ERA", "EXE",
+ "F", "FBT",
"G",
- "I",
- "ICN",
- "INP",
- "ISC",
+ "I", "ICN", "INP", "ISC",
"N",
- "PGH",
- "PIE",
- "PL",
- "PLC",
- "PLE",
- "PLR",
- "PLW",
- "PT",
- "PYI",
+ "PGH", "PIE", "PL", "PLC", "PLE", "PLR", "PLW", "PT", "PYI",
"Q",
- "RUF",
- "RSE",
- "RET",
- "S",
- "SIM",
- "SLF",
- "T",
- "T10",
- "T20",
- "TCH",
- "TID",
- "TRY",
+ "RUF", "RSE", "RET",
+ "S", "SIM", "SLF",
+ "T", "T10", "T20", "TCH", "TID", "TRY",
"UP",
"W",
"YTT",
@@ -73,7 +47,7 @@ ignore = [
"TRY003", # Avoid specifying long messages outside the exception class
]
-[per-file-ignores]
+[lint.per-file-ignores]
"src/*/cli.py" = [
"T201", # Print statement
]
@@ -91,16 +65,16 @@ ignore = [
"S101", # Use of assert detected
]
-[flake8-quotes]
+[lint.flake8-quotes]
docstring-quotes = "double"
-[flake8-tidy-imports]
+[lint.flake8-tidy-imports]
ban-relative-imports = "all"
-[isort]
-known-first-party = ["mkdocstrings_handlers"]
+[lint.isort]
+known-first-party = ["mkdocstrings_handlers.python"]
-[pydocstyle]
+[lint.pydocstyle]
convention = "google"
[format]
diff --git a/config/vscode/launch.json b/config/vscode/launch.json
index d056ccee..e3288388 100644
--- a/config/vscode/launch.json
+++ b/config/vscode/launch.json
@@ -9,6 +9,17 @@
"console": "integratedTerminal",
"justMyCode": false
},
+ {
+ "name": "docs",
+ "type": "debugpy",
+ "request": "launch",
+ "module": "mkdocs",
+ "justMyCode": false,
+ "args": [
+ "serve",
+ "-v"
+ ]
+ },
{
"name": "test",
"type": "debugpy",
diff --git a/config/vscode/settings.json b/config/vscode/settings.json
index 17beee4b..949856d1 100644
--- a/config/vscode/settings.json
+++ b/config/vscode/settings.json
@@ -1,29 +1,9 @@
{
"files.watcherExclude": {
- "**/__pypackages__/**": true,
"**/.venv*/**": true,
+ "**/.venvs*/**": true,
"**/venv*/**": true
},
- "[python]": {
- "editor.defaultFormatter": "ms-python.black-formatter"
- },
- "python.autoComplete.extraPaths": [
- "__pypackages__/3.8/lib",
- "__pypackages__/3.9/lib",
- "__pypackages__/3.10/lib",
- "__pypackages__/3.11/lib",
- "__pypackages__/3.12/lib"
- ],
- "python.analysis.extraPaths": [
- "__pypackages__/3.8/lib",
- "__pypackages__/3.9/lib",
- "__pypackages__/3.10/lib",
- "__pypackages__/3.11/lib",
- "__pypackages__/3.12/lib"
- ],
- "black-formatter.args": [
- "--config=config/black.toml"
- ],
"mypy-type-checker.args": [
"--config-file=config/mypy.ini"
],
@@ -32,6 +12,7 @@
"python.testing.pytestArgs": [
"--config-file=config/pytest.ini"
],
+ "ruff.enable": true,
"ruff.format.args": [
"--config=config/ruff.toml"
],
diff --git a/config/vscode/tasks.json b/config/vscode/tasks.json
index 80cd13d2..30008cf2 100644
--- a/config/vscode/tasks.json
+++ b/config/vscode/tasks.json
@@ -3,84 +3,94 @@
"tasks": [
{
"label": "changelog",
- "type": "shell",
- "command": "pdm run duty changelog"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["changelog"]
},
{
"label": "check",
- "type": "shell",
- "command": "pdm run duty check"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check"]
},
{
"label": "check-quality",
- "type": "shell",
- "command": "pdm run duty check-quality"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check-quality"]
},
{
"label": "check-types",
- "type": "shell",
- "command": "pdm run duty check-types"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check-types"]
},
{
"label": "check-docs",
- "type": "shell",
- "command": "pdm run duty check-docs"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check-docs"]
},
{
"label": "check-dependencies",
- "type": "shell",
- "command": "pdm run duty check-dependencies"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check-dependencies"]
},
{
"label": "check-api",
- "type": "shell",
- "command": "pdm run duty check-api"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["check-api"]
},
{
"label": "clean",
- "type": "shell",
- "command": "pdm run duty clean"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["clean"]
},
{
"label": "docs",
- "type": "shell",
- "command": "pdm run duty docs"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["docs"]
},
{
"label": "docs-deploy",
- "type": "shell",
- "command": "pdm run duty docs-deploy"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["docs-deploy"]
},
{
"label": "format",
- "type": "shell",
- "command": "pdm run duty format"
- },
- {
- "label": "lock",
- "type": "shell",
- "command": "pdm lock -G:all"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["format"]
},
{
"label": "release",
- "type": "shell",
- "command": "pdm run duty release ${input:version}"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["release", "${input:version}"]
},
{
"label": "setup",
- "type": "shell",
- "command": "bash scripts/setup.sh"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["setup"]
},
{
"label": "test",
- "type": "shell",
- "command": "pdm run duty test coverage",
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["test", "coverage"],
"group": "test"
},
{
"label": "vscode",
- "type": "shell",
- "command": "pdm run duty vscode"
+ "type": "process",
+ "command": "scripts/make",
+ "args": ["vscode"]
}
],
"inputs": [
diff --git a/devdeps.txt b/devdeps.txt
new file mode 100644
index 00000000..4fe97996
--- /dev/null
+++ b/devdeps.txt
@@ -0,0 +1,27 @@
+build>=1.0
+duty>=0.10
+black>=23.9
+markdown-callouts>=0.3
+markdown-exec>=1.7
+mkdocs>=1.5
+mkdocs-coverage>=1.0
+mkdocs-gen-files>=0.5
+mkdocs-git-committers-plugin-2>=1.2
+mkdocs-literate-nav>=0.6
+mkdocs-material>=9.4
+mkdocs-minify-plugin>=0.7
+mkdocstrings[python]>=0.23
+tomli>=2.0; python_version < '3.11'
+black>=23.9
+blacken-docs>=1.16
+git-changelog>=2.3
+ruff>=0.0
+pytest>=7.4
+pytest-cov>=4.1
+pytest-randomly>=3.15
+pytest-xdist>=3.3
+mypy>=1.5
+types-markdown>=3.5
+types-pyyaml>=6.0
+safety>=2.3
+twine>=5.0
diff --git a/docs/insiders/goals.yml b/docs/insiders/goals.yml
index 8b6cb2b0..381e5029 100644
--- a/docs/insiders/goals.yml
+++ b/docs/insiders/goals.yml
@@ -9,10 +9,16 @@ goals:
ref: /usage/configuration/headings/#show_symbol_type_toc
since: 2023/06/04
1000:
- name: GraviFridge User Manual
+ name: GraviFridge Fluid Renewal
features:
- name: Auto-summary of object members
ref: /usage/configuration/members/#summary
since: 2023/08/20
- name: Automatic rendering of function signature overloads
since: 2023/09/05
+ 1500:
+ name: HyperLamp Navigation Tips
+ features: []
+ 2000:
+ name: FusionDrive Ejection Configuration
+ features: []
diff --git a/docs/insiders/index.md b/docs/insiders/index.md
index a6642ede..9a0ae309 100644
--- a/docs/insiders/index.md
+++ b/docs/insiders/index.md
@@ -49,9 +49,8 @@ The biggest bottleneck in Open Source is time.[^3]
If you're unsure if you should sponsor this project, check out the list of
[completed funding goals][goals completed] to learn whether you're already using features that
-were developed with the help of sponsorships.
-
+were developed with the help of sponsorships. You're most likely using at least
+a handful of them, [thanks to our awesome sponsors][sponsors]!
## What's in it for me?
@@ -173,7 +172,7 @@ This section lists all funding goals that were previously completed, which means
that those features were part of Insiders, but are now generally available and
can be used by all users.
-```python exec="1" session="insiders"
+```python exec="1" session="insiders" idprefix=""
for goal in goals.values():
if goal.complete:
goal.render()
diff --git a/duties.py b/duties.py
index 55fcf6a2..1c3f6b79 100644
--- a/duties.py
+++ b/duties.py
@@ -22,7 +22,7 @@
CI = os.environ.get("CI", "0") in {"1", "true", "yes", ""}
WINDOWS = os.name == "nt"
PTY = not WINDOWS and not CI
-MULTIRUN = os.environ.get("PDM_MULTIRUN", "0") == "1"
+MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
def pyprefix(title: str) -> str: # noqa: D103
@@ -72,7 +72,6 @@ def check_quality(ctx: Context) -> None:
Parameters:
ctx: The context instance (passed automatically).
"""
- os.environ["MYPYPATH"] = "src"
ctx.run(
ruff.check(*PY_SRC_LIST, config="config/ruff.toml"),
title=pyprefix("Checking code quality"),
@@ -89,15 +88,15 @@ def check_dependencies(ctx: Context) -> None:
"""
# retrieve the list of dependencies
requirements = ctx.run(
- ["pdm", "export", "-f", "requirements", "--without-hashes"],
- title="Exporting dependencies as requirements",
+ ["uv", "pip", "freeze"],
+ silent=True,
allow_overrides=False,
)
ctx.run(
safety.check(requirements),
title="Checking dependencies",
- command="pdm export -f requirements --without-hashes | safety check --stdin",
+ command="uv pip freeze | safety check --stdin",
)
@@ -144,9 +143,9 @@ def check_api(ctx: Context) -> None:
griffe_check = lazy(g_check, name="griffe.check")
ctx.run(
- griffe_check("mkdocstrings_handlers", search_paths=["src"], color=True),
+ griffe_check("mkdocstrings_handlers.python", search_paths=["src"], color=True),
title="Checking for API breaking changes",
- command="griffe check -ssrc mkdocstrings_handlers",
+ command="griffe check -ssrc mkdocstrings_handlers.python",
nofail=True,
)
@@ -201,7 +200,11 @@ def docs_deploy(ctx: Context) -> None:
ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
origin = ctx.run("git config --get remote.origin.url", silent=True)
if "pawamoy-insiders/mkdocstrings-python" in origin:
- ctx.run("git remote add upstream git@github.com:mkdocstrings/python", silent=True, nofail=True)
+ ctx.run(
+ "git remote add upstream git@github.com:mkdocstrings/python",
+ silent=True,
+ nofail=True,
+ )
ctx.run(
mkdocs.gh_deploy(remote_name="upstream", force=True),
title="Deploying documentation",
@@ -247,7 +250,7 @@ def release(ctx: Context, version: str) -> None:
ctx.run(f"git tag {version}", title="Tagging commit", pty=PTY)
ctx.run("git push", title="Pushing commits", pty=False)
ctx.run("git push --tags", title="Pushing tags", pty=False)
- ctx.run("pdm build", title="Building dist/wheel", pty=PTY)
+ ctx.run("pyproject-build", title="Building dist/wheel", pty=PTY)
ctx.run("twine upload --skip-existing dist/*", title="Publishing version", pty=PTY)
diff --git a/pyproject.toml b/pyproject.toml
index 75643e9a..222a7400 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,7 +24,6 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Topic :: Documentation",
"Topic :: Software Development",
- "Topic :: Software Development :: Documentation",
"Topic :: Utilities",
"Typing :: Typed",
]
@@ -45,51 +44,8 @@ Funding = "https://github.com/sponsors/pawamoy"
[tool.pdm]
version = {source = "scm"}
-plugins = [
- "pdm-multirun",
-]
[tool.pdm.build]
package-dir = "src"
includes = ["src/mkdocstrings_handlers"]
editable-backend = "editables"
-
-[tool.pdm.dev-dependencies]
-duty = ["duty>=0.10"]
-ci-quality = ["mkdocstrings-python[duty,docs,quality,typing,security]"]
-ci-tests = ["mkdocstrings-python[duty,docs,tests]"]
-docs = [
- "black>=23.9",
- "markdown-callouts>=0.3",
- "markdown-exec>=1.7",
- "mkdocs>=1.5",
- "mkdocs-coverage>=1.0",
- "mkdocs-gen-files>=0.5",
- "mkdocs-git-committers-plugin-2>=1.2",
- "mkdocs-literate-nav>=0.6",
- "mkdocs-material>=9.4",
- "mkdocs-minify-plugin>=0.7",
- "tomli>=2.0; python_version < '3.11'",
-]
-maintain = [
- "black>=23.9",
- "blacken-docs>=1.16",
- "git-changelog>=2.3",
-]
-quality = [
- "ruff>=0.0",
-]
-tests = [
- "pytest>=7.4",
- "pytest-cov>=4.1",
- "pytest-randomly>=3.15",
- "pytest-xdist>=3.3",
-]
-typing = [
- "mypy>=1.5",
- "types-markdown>=3.5",
- "types-pyyaml>=6.0",
-]
-security = [
- "safety>=2.3",
-]
diff --git a/scripts/gen_credits.py b/scripts/gen_credits.py
index bf35f0da..a1115f55 100644
--- a/scripts/gen_credits.py
+++ b/scripts/gen_credits.py
@@ -3,16 +3,17 @@
from __future__ import annotations
import os
-import re
import sys
-from importlib.metadata import PackageNotFoundError, metadata
+from collections import defaultdict
+from importlib.metadata import distributions
from itertools import chain
from pathlib import Path
from textwrap import dedent
-from typing import Mapping, cast
+from typing import Dict, Iterable, Union
from jinja2 import StrictUndefined
from jinja2.sandbox import SandboxedEnvironment
+from packaging.requirements import Requirement
# TODO: Remove once support for Python 3.10 is dropped.
if sys.version_info >= (3, 11):
@@ -24,71 +25,120 @@
with project_dir.joinpath("pyproject.toml").open("rb") as pyproject_file:
pyproject = tomllib.load(pyproject_file)
project = pyproject["project"]
-pdm = pyproject["tool"]["pdm"]
-with project_dir.joinpath("pdm.lock").open("rb") as lock_file:
- lock_data = tomllib.load(lock_file)
-lock_pkgs = {pkg["name"].lower(): pkg for pkg in lock_data["package"]}
project_name = project["name"]
-regex = re.compile(r"(?P[\w.-]+)(?P.*)$")
+with open("devdeps.txt") as devdeps_file:
+ devdeps = [line.strip() for line in devdeps_file if not line.startswith("-e")]
+PackageMetadata = Dict[str, Union[str, Iterable[str]]]
+Metadata = Dict[str, PackageMetadata]
-def _get_license(pkg_name: str) -> str:
+
+def _merge_fields(metadata: dict) -> PackageMetadata:
+ fields = defaultdict(list)
+ for header, value in metadata.items():
+ fields[header.lower()].append(value.strip())
+ return {
+ field: value if len(value) > 1 or field in ("classifier", "requires-dist") else value[0]
+ for field, value in fields.items()
+ }
+
+
+def _norm_name(name: str) -> str:
+ return name.replace("_", "-").replace(".", "-").lower()
+
+
+def _norm_spec(spec: str) -> set[str]:
+ clean_spec = spec.split("]", 1)[-1].split(";", 1)[0].replace("(", "").replace(")", "").replace(" ", "").strip()
+ if clean_spec:
+ return set(clean_spec.split(","))
+ return set()
+
+
+def _requirements(deps: list[str]) -> dict[str, Requirement]:
+ return {_norm_name((req := Requirement(dep)).name): req for dep in deps}
+
+
+def _extra_marker(req: Requirement) -> str | None:
+ if not req.marker:
+ return None
try:
- data = metadata(pkg_name)
- except PackageNotFoundError:
- return "?"
- license_name = cast(dict, data).get("License", "").strip()
- multiple_lines = bool(license_name.count("\n"))
- # TODO: Remove author logic once all my packages licenses are fixed.
- author = ""
- if multiple_lines or not license_name or license_name == "UNKNOWN":
- for header, value in cast(dict, data).items():
- if header == "Classifier" and value.startswith("License ::"):
- license_name = value.rsplit("::", 1)[1].strip()
- elif header == "Author-email":
- author = value
- if license_name == "Other/Proprietary License" and "pawamoy" in author:
- license_name = "ISC"
- return license_name or "?"
-
-
-def _get_deps(base_deps: Mapping[str, Mapping[str, str]]) -> dict[str, dict[str, str]]:
+ return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra")
+ except StopIteration:
+ return None
+
+
+def _get_metadata() -> Metadata:
+ metadata = {}
+ for pkg in distributions():
+ name = _norm_name(pkg.name) # type: ignore[attr-defined,unused-ignore]
+ metadata[name] = _merge_fields(pkg.metadata) # type: ignore[arg-type]
+ metadata[name]["spec"] = set()
+ metadata[name]["extras"] = set()
+ _set_license(metadata[name])
+ return metadata
+
+
+def _set_license(metadata: PackageMetadata) -> None:
+ license_field = metadata.get("license-expression", metadata.get("license", ""))
+ license_name = license_field if isinstance(license_field, str) else " + ".join(license_field)
+ check_classifiers = license_name in ("UNKNOWN", "Dual License", "") or license_name.count("\n")
+ if check_classifiers:
+ license_names = []
+ for classifier in metadata["classifier"]:
+ if classifier.startswith("License ::"):
+ license_names.append(classifier.rsplit("::", 1)[1].strip())
+ license_name = " + ".join(license_names)
+ metadata["license"] = license_name or "?"
+
+
+def _get_deps(base_deps: dict[str, Requirement], metadata: Metadata) -> Metadata:
deps = {}
- for dep in base_deps:
- parsed = regex.match(dep).groupdict() # type: ignore[union-attr]
- dep_name = parsed["dist"].lower()
- if dep_name not in lock_pkgs:
+ for dep_name, dep_req in base_deps.items():
+ if dep_name not in metadata:
continue
- deps[dep_name] = {"license": _get_license(dep_name), **parsed, **lock_pkgs[dep_name]}
+ metadata[dep_name]["spec"] |= {str(spec) for spec in dep_req.specifier} # type: ignore[operator]
+ metadata[dep_name]["extras"] |= dep_req.extras # type: ignore[operator]
+ deps[dep_name] = metadata[dep_name]
again = True
while again:
again = False
- for pkg_name in lock_pkgs:
+ for pkg_name in metadata:
if pkg_name in deps:
- for pkg_dependency in lock_pkgs[pkg_name].get("dependencies", []):
- parsed = regex.match(pkg_dependency).groupdict() # type: ignore[union-attr]
- dep_name = parsed["dist"].lower()
- if dep_name in lock_pkgs and dep_name not in deps and dep_name != project["name"]:
- deps[dep_name] = {"license": _get_license(dep_name), **parsed, **lock_pkgs[dep_name]}
+ for pkg_dependency in metadata[pkg_name].get("requires-dist", []):
+ requirement = Requirement(pkg_dependency)
+ dep_name = _norm_name(requirement.name)
+ extra_marker = _extra_marker(requirement)
+ if (
+ dep_name in metadata
+ and dep_name not in deps
+ and dep_name != project["name"]
+ and (not extra_marker or extra_marker in deps[pkg_name]["extras"])
+ ):
+ metadata[dep_name]["spec"] |= {str(spec) for spec in requirement.specifier} # type: ignore[operator]
+ deps[dep_name] = metadata[dep_name]
again = True
return deps
def _render_credits() -> str:
- dev_dependencies = _get_deps(chain(*pdm.get("dev-dependencies", {}).values())) # type: ignore[arg-type]
+ metadata = _get_metadata()
+ dev_dependencies = _get_deps(_requirements(devdeps), metadata)
prod_dependencies = _get_deps(
- chain( # type: ignore[arg-type]
- project.get("dependencies", []),
- chain(*project.get("optional-dependencies", {}).values()),
+ _requirements(
+ chain( # type: ignore[arg-type]
+ project.get("dependencies", []),
+ chain(*project.get("optional-dependencies", {}).values()),
+ ),
),
+ metadata,
)
template_data = {
"project_name": project_name,
- "prod_dependencies": sorted(prod_dependencies.values(), key=lambda dep: dep["name"]),
- "dev_dependencies": sorted(dev_dependencies.values(), key=lambda dep: dep["name"]),
+ "prod_dependencies": sorted(prod_dependencies.values(), key=lambda dep: str(dep["name"])),
+ "dev_dependencies": sorted(dev_dependencies.values(), key=lambda dep: str(dep["name"])),
"more_credits": "http://pawamoy.github.io/credits/",
}
template_text = dedent(
@@ -98,13 +148,14 @@ def _render_credits() -> str:
These projects were used to build *{{ project_name }}*. **Thank you!**
[`python`](https://www.python.org/) |
- [`pdm`](https://pdm.fming.dev/) |
- [`copier-pdm`](https://github.com/pawamoy/copier-pdm)
+ [`uv`](https://github.com/astral-sh/uv) |
+ [`copier-uv`](https://github.com/pawamoy/copier-uv)
{% macro dep_line(dep) -%}
- [`{{ dep.name }}`](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
+ [`{{ dep.name }}`](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec|sort(reverse=True)|join(", ") ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
{%- endmacro %}
+ {% if prod_dependencies -%}
### Runtime dependencies
Project | Summary | Version (accepted) | Version (last resolved) | License
@@ -113,6 +164,8 @@ def _render_credits() -> str:
{{ dep_line(dep) }}
{% endfor %}
+ {% endif -%}
+ {% if dev_dependencies -%}
### Development dependencies
Project | Summary | Version (accepted) | Version (last resolved) | License
@@ -121,6 +174,7 @@ def _render_credits() -> str:
{{ dep_line(dep) }}
{% endfor %}
+ {% endif -%}
{% if more_credits %}**[More credits from the author]({{ more_credits }})**{% endif %}
""",
)
diff --git a/scripts/insiders.py b/scripts/insiders.py
index 85ecbd0e..15212486 100644
--- a/scripts/insiders.py
+++ b/scripts/insiders.py
@@ -78,9 +78,16 @@ def human_readable_amount(self) -> str: # noqa: D102
def render(self, rel_base: str = "..") -> None: # noqa: D102
print(f"#### $ {self.human_readable_amount} — {self.name}\n")
- for feature in self.features:
- feature.render(rel_base)
- print("")
+ if self.features:
+ for feature in self.features:
+ feature.render(rel_base)
+ print("")
+ else:
+ print("There are no features in this goal for this project. ")
+ print(
+ "[See the features in this goal **for all Insiders projects.**]"
+ f"(https://pawamoy.github.io/insiders/#{self.amount}-{self.name.lower().replace(' ', '-')})",
+ )
def load_goals(data: str, funding: int = 0, project: Project | None = None) -> dict[int, Goal]:
@@ -104,8 +111,7 @@ def load_goals(data: str, funding: int = 0, project: Project | None = None) -> d
Feature(
name=feature_data["name"],
ref=feature_data.get("ref"),
- since=feature_data.get("since")
- and datetime.strptime(feature_data["since"], "%Y/%m/%d").date(), # noqa: DTZ007
+ since=feature_data.get("since") and datetime.strptime(feature_data["since"], "%Y/%m/%d").date(), # noqa: DTZ007
project=project,
)
for feature_data in goal_data["features"]
diff --git a/scripts/make b/scripts/make
new file mode 100755
index 00000000..4190622e
--- /dev/null
+++ b/scripts/make
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+
+set -e
+export PYTHON_VERSIONS=${PYTHON_VERSIONS-3.8 3.9 3.10 3.11 3.12}
+
+exe=""
+prefix=""
+
+
+# Install runtime and development dependencies,
+# as well as current project in editable mode.
+uv_install() {
+ uv pip compile pyproject.toml devdeps.txt | uv pip install -r -
+ uv pip install -e .
+}
+
+
+# Setup the development environment by installing dependencies
+# in multiple Python virtual environments with uv:
+# one venv per Python version in `.venvs/$py`,
+# and an additional default venv in `.venv`.
+setup() {
+ if ! command -v uv &>/dev/null; then
+ echo "make: setup: uv must be installed, see https://github.com/astral-sh/uv" >&2
+ return 1
+ fi
+
+ if [ -n "${PYTHON_VERSIONS}" ]; then
+ for version in ${PYTHON_VERSIONS}; do
+ if [ ! -d ".venvs/${version}" ]; then
+ uv venv --seed --python "${version}" ".venvs/${version}"
+ fi
+ VIRTUAL_ENV="${PWD}/.venvs/${version}" uv_install
+ done
+ fi
+
+ if [ ! -d .venv ]; then uv venv --seed --python python; fi
+ uv_install
+}
+
+
+# Activate a Python virtual environments.
+# The annoying operating system also requires
+# that we set some global variables to help it find commands...
+activate() {
+ local path
+ if [ -f "$1/bin/activate" ]; then
+ source "$1/bin/activate"
+ return 0
+ fi
+ if [ -f "$1/Scripts/activate.bat" ]; then
+ "$1/Scripts/activate.bat"
+ exe=".exe"
+ prefix="$1/Scripts/"
+ return 0
+ fi
+ echo "run: Cannot activate venv $1" >&2
+ return 1
+}
+
+
+# Run a command in all configured Python virtual environments.
+# We handle the case when the `PYTHON_VERSIONS` environment variable
+# is unset or empty, for robustness.
+multirun() {
+ local cmd="$1"
+ shift
+
+ if [ -n "${PYTHON_VERSIONS}" ]; then
+ for version in ${PYTHON_VERSIONS}; do
+ (activate ".venvs/${version}" && MULTIRUN=1 "${prefix}${cmd}${exe}" "$@")
+ done
+ else
+ (activate .venv && "${prefix}${cmd}${exe}" "$@")
+ fi
+}
+
+
+# Run a command in the default Python virtual environment.
+# We rely on `multirun`'s handling of empty `PYTHON_VERSIONS`.
+singlerun() {
+ PYTHON_VERSIONS= multirun "$@"
+}
+
+
+# Record options following a command name,
+# until a non-option argument is met or there are no more arguments.
+# Output each option on a new line, so the parent caller can store them in an array.
+# Return the number of times the parent caller must shift arguments.
+options() {
+ local shift_count=0
+ for arg in "$@"; do
+ if [[ "${arg}" =~ ^- || "${arg}" =~ ^.+= ]]; then
+ echo "${arg}"
+ ((shift_count++))
+ else
+ break
+ fi
+ done
+ return ${shift_count}
+}
+
+
+# Main function.
+main() {
+ local cmd
+ while [ $# -ne 0 ]; do
+ cmd="$1"
+ shift
+
+ # Handle `run` early to simplify `case` below.
+ if [ "${cmd}" = "run" ]; then
+ singlerun "$@"
+ exit $?
+ fi
+
+ # Handle `multirun` early to simplify `case` below.
+ if [ "${cmd}" = "multirun" ]; then
+ multirun "$@"
+ exit $?
+ fi
+
+ # All commands except `run` and `multirun` can be chained on a single line.
+ # Some of them accept options in two formats: `-f`, `--flag` and `param=value`.
+ # Some of them don't, and will print warnings/errors if options were given.
+ opts=($(options "$@")) || shift $?
+
+ case "${cmd}" in
+ # The following commands require special handling.
+ help|"")
+ singlerun duty --list ;;
+ setup)
+ setup ;;
+ check)
+ multirun duty check-quality check-types check-docs
+ singlerun duty check-dependencies check-api
+ ;;
+
+ # The following commands run in all venvs.
+ check-quality|\
+ check-docs|\
+ check-types|\
+ test)
+ multirun duty "${cmd}" "${opts[@]}" ;;
+
+ # The following commands run in the default venv only.
+ *)
+ singlerun duty "${cmd}" "${opts[@]}" ;;
+ esac
+ done
+}
+
+
+# Execute the main function.
+main "$@"
diff --git a/scripts/setup.sh b/scripts/setup.sh
deleted file mode 100755
index eef38433..00000000
--- a/scripts/setup.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-if ! command -v pdm &>/dev/null; then
- if ! command -v pipx &>/dev/null; then
- python3 -m pip install --user pipx
- fi
- pipx install pdm
-fi
-if ! pdm self list 2>/dev/null | grep -q pdm-multirun; then
- pdm install --plugins
-fi
-
-if [ -n "${PDM_MULTIRUN_VERSIONS}" ]; then
- if [ "${PDM_MULTIRUN_USE_VENVS}" -eq "1" ]; then
- for version in ${PDM_MULTIRUN_VERSIONS}; do
- if ! pdm venv --path "${version}" &>/dev/null; then
- pdm venv create --name "${version}" "${version}"
- fi
- done
- fi
- pdm multirun -v pdm install -G:all
-else
- pdm install -G:all
-fi
diff --git a/src/mkdocstrings_handlers/python/__init__.py b/src/mkdocstrings_handlers/python/__init__.py
index f93ab20e..0432a90d 100644
--- a/src/mkdocstrings_handlers/python/__init__.py
+++ b/src/mkdocstrings_handlers/python/__init__.py
@@ -1,9 +1,5 @@
-"""This package implements a handler for the Python language."""
+"""Python handler for mkdocstrings."""
from mkdocstrings_handlers.python.handler import get_handler
__all__ = ["get_handler"]
-
-# TODO: CSS classes everywhere in templates
-# TODO: name normalization (filenames, Jinja2 variables, HTML tags, CSS classes)
-# TODO: Jinja2 blocks everywhere in templates
diff --git a/src/mkdocstrings_handlers/py.typed b/src/mkdocstrings_handlers/python/py.typed
similarity index 100%
rename from src/mkdocstrings_handlers/py.typed
rename to src/mkdocstrings_handlers/python/py.typed
diff --git a/tests/conftest.py b/tests/conftest.py
index 1c1a1c54..f7b28105 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -60,7 +60,7 @@ def fixture_plugin(mkdocs_conf: config.Config) -> MkdocstringsPlugin:
"""Return a plugin instance.
Parameters:
- mkdocs_conf: Pytest fixture: [tests.conftest.fixture_mkdocs_conf][].
+ mkdocs_conf: Pytest fixture (see conftest.py).
Returns:
mkdocstrings plugin instance.
@@ -73,7 +73,7 @@ def fixture_ext_markdown(mkdocs_conf: config.Config) -> Markdown:
"""Return a Markdown instance with MkdocstringsExtension.
Parameters:
- mkdocs_conf: Pytest fixture: [tests.conftest.fixture_mkdocs_conf][].
+ mkdocs_conf: Pytest fixture (see conftest.py).
Returns:
A Markdown instance.
@@ -86,7 +86,7 @@ def fixture_handler(plugin: MkdocstringsPlugin, ext_markdown: Markdown) -> Pytho
"""Return a handler instance.
Parameters:
- plugin: Pytest fixture: [tests.conftest.fixture_plugin][].
+ plugin: Pytest fixture (see conftest.py).
Returns:
A handler instance.
diff --git a/tests/test_themes.py b/tests/test_themes.py
index bedcc806..a4ad0d59 100644
--- a/tests/test_themes.py
+++ b/tests/test_themes.py
@@ -2,7 +2,6 @@
from __future__ import annotations
-import sys
from typing import TYPE_CHECKING
import pytest
@@ -22,7 +21,7 @@
indirect=["plugin"],
)
@pytest.mark.parametrize(
- "module",
+ "identifier",
[
"mkdocstrings.extension",
"mkdocstrings.inventory",
@@ -33,15 +32,15 @@
"mkdocstrings_handlers.python",
],
)
-@pytest.mark.skipif(sys.version_info < (3, 7), reason="material is not installed on Python 3.6")
-def test_render_themes_templates_python(module: str, plugin: MkdocstringsPlugin, ext_markdown: Markdown) -> None:
+def test_render_themes_templates_python(identifier: str, plugin: MkdocstringsPlugin, ext_markdown: Markdown) -> None:
"""Test rendering of a given theme's templates.
Parameters:
- module: Parametrized argument.
- plugin: Pytest fixture: [tests.conftest.fixture_plugin][].
+ identifier: Parametrized identifier.
+ plugin: Pytest fixture (see conftest.py).
+ ext_markdown: Pytest fixture (see conftest.py).
"""
handler = plugin.handlers.get_handler("python")
handler._update_env(ext_markdown, plugin.handlers._config)
- data = handler.collect(module, {})
+ data = handler.collect(identifier, {})
handler.render(data, {})
From cd93ee31418a2752667d43bb5a05d22284522c24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 19:58:24 +0100
Subject: [PATCH 021/243] deps: Add upper bound on Python-Markdown 3.6 to
temporarily prevent breaking changes
---
pyproject.toml | 1 +
1 file changed, 1 insertion(+)
diff --git a/pyproject.toml b/pyproject.toml
index 222a7400..05438338 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,6 +28,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
+ "markdown>=3.3,<3.6",
"mkdocstrings>=0.20",
"griffe>=0.37",
]
From ddf32c6697f895287c9f5546e51656183e569cf3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 20:02:25 +0100
Subject: [PATCH 022/243] docs: Enable inline syntax highlight
---
mkdocs.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mkdocs.yml b/mkdocs.yml
index 3d21de72..9a739787 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -111,6 +111,10 @@ markdown_extensions:
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
+- pymdownx.highlight:
+ pygments_lang_class: true
+- pymdownx.inlinehilite:
+ style_plain_text: py3
- pymdownx.magiclink
- pymdownx.snippets:
auto_append: [docs/.glossary.md]
From e639c8b1a07aed6ac25eb86c790d7cea1f1628c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 20:04:48 +0100
Subject: [PATCH 023/243] chore: Prepare release 1.9.0
---
CHANGELOG.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c5647dd..4bc0d6a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.9.0](https://github.com/mkdocstrings/python/releases/tag/1.9.0) - 2024-03-13
+
+[Compare with 1.8.0](https://github.com/mkdocstrings/python/compare/1.8.0...1.9.0)
+
+### Dependencies
+
+- Add upper bound on Python-Markdown 3.6 to temporarily prevent breaking changes ([cd93ee3](https://github.com/mkdocstrings/python/commit/cd93ee31418a2752667d43bb5a05d22284522c24) by Timothée Mazzucotelli).
+
+### Features
+
+- Add `show_labels` option to show/hide labels ([eaf9b82](https://github.com/mkdocstrings/python/commit/eaf9b8240069f7369f401fe048892043c8b173d3) by Viicos). [Issue #120](https://github.com/mkdocstrings/python/issues/120), [PR #130](https://github.com/mkdocstrings/python/pull/130)
+- Add option to search for stubs packages ([0c6aa32](https://github.com/mkdocstrings/python/commit/0c6aa323c9e57b8348765a5daa11c79d0c5edb07) by Romain). [PR #128](https://github.com/mkdocstrings/python/pull/128), PR griffe#221: : https://github.com/mkdocstrings/griffe/pull/221
+
+### Code Refactoring
+
+- Mark all Jinja blocks as scoped ([548bdad](https://github.com/mkdocstrings/python/commit/548bdaddd66ffc99b3b9a5a62228a2ff4ff0dd00) by Timothée Mazzucotelli).
+
## [1.8.0](https://github.com/mkdocstrings/python/releases/tag/1.8.0) - 2024-01-08
[Compare with 1.7.5](https://github.com/mkdocstrings/python/compare/1.7.5...1.8.0)
From e5ccb4f4a5b14170307ca0e5a5bc151d25830720 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 13 Mar 2024 20:17:23 +0100
Subject: [PATCH 024/243] ci: Fix CI workflow
---
.github/workflows/ci.yml | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f3b59817..384bf7cc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -55,29 +55,6 @@ jobs:
- name: Check for breaking changes in the API
run: make check-api
- exclude-test-jobs:
- runs-on: ubuntu-latest
- outputs:
- jobs: ${{ steps.exclude-jobs.outputs.jobs }}
- steps:
- - id: exclude-jobs
- run: |
- if ${{ github.repository_owner == 'pawamoy-insiders' }}; then
- echo 'jobs=[
- {"os": "macos-latest"},
- {"os": "windows-latest"},
- {"python-version": "3.9"},
- {"python-version": "3.10"},
- {"python-version": "3.11"},
- {"python-version": "3.12"}
- ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
- else
- echo 'jobs=[]' >> $GITHUB_OUTPUT
- fi
-
- - name: Check for breaking changes in the API
- run: pdm run duty check-api
-
exclude-test-jobs:
runs-on: ubuntu-latest
outputs:
From 7c8b885fa2b704e719016acb35791723ea3a496a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 24 Mar 2024 16:11:04 +0100
Subject: [PATCH 025/243] refactor: Maintain original Pygments color for
cross-refs in signatures
---
.../python/templates/material/style.css | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/style.css b/src/mkdocstrings_handlers/python/templates/material/style.css
index 82086b8f..805c64c3 100644
--- a/src/mkdocstrings_handlers/python/templates/material/style.css
+++ b/src/mkdocstrings_handlers/python/templates/material/style.css
@@ -105,4 +105,9 @@ code.doc-symbol-module {
code.doc-symbol-module::after {
content: "mod";
-}
\ No newline at end of file
+}
+
+.doc-signature .autorefs {
+ color: inherit;
+ border-bottom: 1px dotted currentcolor;
+}
From 1fc4cb54ab1f7dede1eb655bd98c5a9866efd361 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 24 Mar 2024 16:11:15 +0100
Subject: [PATCH 026/243] docs: Use current color for autorefs external link
icon
---
docs/css/mkdocstrings.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/css/mkdocstrings.css b/docs/css/mkdocstrings.css
index 727a614c..03c39d33 100644
--- a/docs/css/mkdocstrings.css
+++ b/docs/css/mkdocstrings.css
@@ -18,10 +18,10 @@ a.autorefs-external::after {
height: 1em;
width: 1em;
- background-color: var(--md-typeset-a-color);
+ background-color: currentColor;
}
a.external:hover::after,
a.autorefs-external:hover::after {
background-color: var(--md-accent-fg-color);
-}
\ No newline at end of file
+}
From d62daa71d17be1790d1b61ec83eabcc43db7a684 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 24 Mar 2024 16:11:29 +0100
Subject: [PATCH 027/243] docs: Document customization of syntax highlight in
signatures
---
docs/usage/customization.md | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/docs/usage/customization.md b/docs/usage/customization.md
index 14721092..2567870e 100644
--- a/docs/usage/customization.md
+++ b/docs/usage/customization.md
@@ -348,10 +348,36 @@ Available context:
- `section`: The [DocstringSection][griffe.docstrings.dataclasses.DocstringSection] instance (see `DocstringSection*` subclasses).
-## Style recommendations
+### Syntax highlight in signatures
+
+You can customize the colors in syntax highlighted signatures.
+If you are using the [Material for MkDocs] theme,
+here are some customization examples:
-
+```css
+/* Fancier color for operators such as * and |. */
+.doc-signature .o {
+ color: var(--md-code-hl-special-color);
+}
+/* Fancier color for constants such as None, True, and False. */
+.doc-signature .kc {
+ color: var(--md-code-hl-constant-color);
+}
+
+/* Fancier color for built-in types (only useful when cross-references are used). */
+.doc-signature .n > a[href^="https://docs.python.org/"][href*="/functions.html#"],
+.doc-signature .n > a[href^="https://docs.python.org/"][href*="/stdtypes.html#"] {
+ color: var(--md-code-hl-constant-color);
+}
+```
+
+For other themes, use their own CSS variables,
+or use plain colors such as `violet` or `#2987f2`.
+
+## Style recommendations
+
+[](){#recommended-style-material}
### Material
Here are some CSS rules for the [Material for MkDocs] theme:
@@ -360,8 +386,7 @@ Here are some CSS rules for the [Material for MkDocs] theme:
--8<-- "docs/css/mkdocstrings.css"
```
-
-
+[](){#recommended-style-readthedocs}
### ReadTheDocs
Here are some CSS rules for the built-in ReadTheDocs theme:
From f798a1e19dbac548420dcbe1172e9a49232b615b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 24 Mar 2024 16:11:41 +0100
Subject: [PATCH 028/243] refactor: Allow first name in a separate signature to
be highlighted as a function name
---
src/mkdocstrings_handlers/python/rendering.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py
index b1cb7ffc..878b74aa 100644
--- a/src/mkdocstrings_handlers/python/rendering.py
+++ b/src/mkdocstrings_handlers/python/rendering.py
@@ -166,6 +166,15 @@ def do_format_signature(
),
)
+ # Since we highlight the signature without `def`,
+ # Pygments sees it as a function call and not a function definition.
+ # The result is that the function name is not parsed as such,
+ # but instead as a regular name: `n` CSS class instead of `nf`.
+ # To fix it, we replace the first occurrence of an `n` CSS class
+ # with an `nf` one, unless we found `nf` already.
+ if signature.find('class="nf"') == -1:
+ signature = signature.replace('class="n"', 'class="nf"', 1)
+
if stash:
for key, value in stash.items():
signature = re.sub(rf"\b{key}\b", value, signature)
From 3cf7055a6620e5121f01ca65e589ce8992e8d745 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 24 Mar 2024 16:11:51 +0100
Subject: [PATCH 029/243] docs: Fix link to Griffe extension in insiders page
---
docs/insiders/index.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/insiders/index.md b/docs/insiders/index.md
index 9a0ae309..123fe42d 100644
--- a/docs/insiders/index.md
+++ b/docs/insiders/index.md
@@ -59,7 +59,7 @@ data_source = [
"docs/insiders/goals.yml",
("griffe-inherited-docstrings", "https://mkdocstrings.github.io/griffe-inherited-docstrings/", "insiders/goals.yml"),
("griffe-pydantic", "https://mkdocstrings.github.io/griffe-pydantic/", "insiders/goals.yml"),
- ("griffe-typing-deprecated", "https://mkdocstrings.github.io/griffe-typing-deprecated/", "insiders/goals.yml"),
+ ("griffe-warnings-deprecated", "https://mkdocstrings.github.io/griffe-warnings-deprecated/", "insiders/goals.yml"),
]
```
From bd7349714059afb1295e743dbc82380fa797a032 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Tue, 2 Apr 2024 18:43:59 +0200
Subject: [PATCH 030/243] fix: Don't try loading packages from relative paths
Issue-145: https://github.com/mkdocstrings/python/issues/145
---
src/mkdocstrings_handlers/python/handler.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index c5217e98..fa8e384c 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -283,8 +283,16 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> CollectorItem:
try:
for pre_loaded_module in final_config.get("preload_modules") or []:
if pre_loaded_module not in self._modules_collection:
- loader.load(pre_loaded_module, find_stubs_package=final_config["find_stubs_package"])
- loader.load(module_name, find_stubs_package=final_config["find_stubs_package"])
+ loader.load(
+ pre_loaded_module,
+ try_relative_path=False,
+ find_stubs_package=final_config["find_stubs_package"],
+ )
+ loader.load(
+ module_name,
+ try_relative_path=False,
+ find_stubs_package=final_config["find_stubs_package"],
+ )
except ImportError as error:
raise CollectionError(str(error)) from error
unresolved, iterations = loader.resolve_aliases(
From d3b05ade6f35d914feb44317a48ed78f0e0d5391 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Tue, 2 Apr 2024 18:48:07 +0200
Subject: [PATCH 031/243] chore: Prepare release 1.9.1
---
CHANGELOG.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4bc0d6a2..5a06cd76 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.9.1](https://github.com/mkdocstrings/python/releases/tag/1.9.1) - 2024-04-02
+
+[Compare with 1.9.0](https://github.com/mkdocstrings/python/compare/1.9.0...1.9.1)
+
+### Bug Fixes
+
+- Don't try loading packages from relative paths ([bd73497](https://github.com/mkdocstrings/python/commit/bd7349714059afb1295e743dbc82380fa797a032) by Timothée Mazzucotelli). [Issue-145](https://github.com/mkdocstrings/python/issues/145)
+
+### Code Refactoring
+
+- Allow first name in a separate signature to be highlighted as a function name ([f798a1e](https://github.com/mkdocstrings/python/commit/f798a1e19dbac548420dcbe1172e9a49232b615b) by Timothée Mazzucotelli).
+- Maintain original Pygments color for cross-refs in signatures ([7c8b885](https://github.com/mkdocstrings/python/commit/7c8b885fa2b704e719016acb35791723ea3a496a) by Timothée Mazzucotelli).
+
## [1.9.0](https://github.com/mkdocstrings/python/releases/tag/1.9.0) - 2024-03-13
[Compare with 1.8.0](https://github.com/mkdocstrings/python/compare/1.8.0...1.9.0)
From 0c1e2c15b2497d99974cbb9bd68f25056bb8451b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Tue, 2 Apr 2024 21:27:22 +0200
Subject: [PATCH 032/243] deps: Remove cap on Python-Markdown 3.6 now that ToC
labels are fixed by mkdocstrings
---
pyproject.toml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 05438338..1ce73547 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,8 +28,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
- "markdown>=3.3,<3.6",
- "mkdocstrings>=0.20",
+ "mkdocstrings>=0.24.2",
"griffe>=0.37",
]
From 0a2e917cca07ad54ea7da782ab7914f9c9accc5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Tue, 2 Apr 2024 21:27:58 +0200
Subject: [PATCH 033/243] chore: Prepare release 1.9.2
---
CHANGELOG.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5a06cd76..b0e9c966 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.9.2](https://github.com/mkdocstrings/python/releases/tag/1.9.2) - 2024-04-02
+
+[Compare with 1.9.1](https://github.com/mkdocstrings/python/compare/1.9.1...1.9.2)
+
+### Dependencies
+
+- Remove cap on Python-Markdown 3.6 now that ToC labels are fixed by mkdocstrings ([0c1e2c1](https://github.com/mkdocstrings/python/commit/0c1e2c15b2497d99974cbb9bd68f25056bb8451b) by Timothée Mazzucotelli).
+
## [1.9.1](https://github.com/mkdocstrings/python/releases/tag/1.9.1) - 2024-04-02
[Compare with 1.9.0](https://github.com/mkdocstrings/python/compare/1.9.0...1.9.1)
From d6e1d68c099e61c3bd6d93e583708335d84158f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Fri, 12 Apr 2024 16:59:55 +0200
Subject: [PATCH 034/243] feat: Add CSS classes `doc-section-title` and
`doc-section-item` in docstring sections
Issue-17: https://github.com/mkdocstrings/python/issues/17
---
.../material/_base/docstring/attributes.html | 14 +++++++-------
.../material/_base/docstring/classes.html | 14 +++++++-------
.../material/_base/docstring/examples.html | 2 +-
.../material/_base/docstring/functions.html | 14 +++++++-------
.../material/_base/docstring/modules.html | 14 +++++++-------
.../material/_base/docstring/other_parameters.html | 14 +++++++-------
.../material/_base/docstring/parameters.html | 14 +++++++-------
.../templates/material/_base/docstring/raises.html | 14 +++++++-------
.../material/_base/docstring/receives.html | 14 +++++++-------
.../material/_base/docstring/returns.html | 14 +++++++-------
.../templates/material/_base/docstring/warns.html | 14 +++++++-------
.../templates/material/_base/docstring/yields.html | 14 +++++++-------
.../python/templates/material/style.css | 5 +++++
13 files changed, 83 insertions(+), 78 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
index 88c5990d..771a9eed 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
+ {{ section.title or lang.t("Attributes:") }}
@@ -15,7 +15,7 @@
{% for attribute in section.value %}
-
+
{{ attribute.name }} |
{% if attribute.annotation %}
@@ -36,10 +36,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
+ {{ section.title or lang.t("Attributes:") }}
{% for attribute in section.value %}
- -
+
-
{{ attribute.name }}
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
@@ -59,13 +59,13 @@
- | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for attribute in section.value %}
-
+
{{ attribute.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
index b8ad2e0f..054cf5af 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Classes:") }}
+ {{ section.title or lang.t("Classes:") }}
@@ -14,7 +14,7 @@
{% for class in section.value %}
-
+
{{ class.name }} |
@@ -28,10 +28,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Classes:") }}
+ {{ section.title or lang.t("Classes:") }}
{% for class in section.value %}
- -
+
-
{{ class.name }}
–
@@ -46,13 +46,13 @@
- | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for class in section.value %}
-
+
{{ class.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
index bbec5e22..5305efa9 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
@@ -2,7 +2,7 @@
{% import "language.html" as lang with context %}
- {{ section.title or lang.t("Examples:") }}
+ {{ section.title or lang.t("Examples:") }}
{% for section_type, sub_section in section.value %}
{% if section_type.value == "text" %}
{{ sub_section|convert_markdown(heading_level, html_id) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
index ab1939f5..a16917bd 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
@@ -15,7 +15,7 @@
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
-
+
{{ function.name }} |
@@ -30,11 +30,11 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
- -
+
-
{{ function.name }}
–
@@ -50,14 +50,14 @@
- | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
-
+
{{ function.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
index f771f20b..26b38257 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Modules:") }}
+ {{ section.title or lang.t("Modules:") }}
@@ -14,7 +14,7 @@
{% for module in section.value %}
-
+
{{ module.name }} |
@@ -28,10 +28,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Modules:") }}
+ {{ section.title or lang.t("Modules:") }}
{% for module in section.value %}
- -
+
-
{{ module.name }}
–
@@ -46,13 +46,13 @@
- | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for module in section.value %}
-
+
{{ module.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
index 7ede6715..f31836a8 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
+ {{ section.title or lang.t("Other Parameters:") }}
@@ -15,7 +15,7 @@
{% for parameter in section.value %}
-
+
{{ parameter.name }} |
{% if parameter.annotation %}
@@ -36,10 +36,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
+ {{ section.title or lang.t("Other Parameters:") }}
{% for parameter in section.value %}
- -
+
-
{{ parameter.name }}
{% if parameter.annotation %}
{% with expression = parameter.annotation %}
@@ -59,13 +59,13 @@
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for parameter in section.value %}
-
+
{{ parameter.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
index 7b4788ca..05bdadee 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
+ {{ section.title or lang.t("Parameters:") }}
@@ -16,7 +16,7 @@
{% for parameter in section.value %}
-
+
{{ parameter.name }} |
{% if parameter.annotation %}
@@ -46,10 +46,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
+ {{ section.title or lang.t("Parameters:") }}
{% for parameter in section.value %}
- -
+
-
{{ parameter.name }}
{% if parameter.annotation %}
{% with expression = parameter.annotation %}
@@ -74,13 +74,13 @@
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for parameter in section.value %}
-
+
{{ parameter.name }} |
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
index 396ccc73..5e20b653 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Raises:") }}
+ {{ section.title or lang.t("Raises:") }}
@@ -14,7 +14,7 @@
{% for raises in section.value %}
-
+
|
{% if raises.annotation %}
{% with expression = raises.annotation %}
@@ -34,10 +34,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ lang.t(section.title) or lang.t("Raises:") }}
+ {{ lang.t(section.title) or lang.t("Raises:") }}
{% for raises in section.value %}
- -
+
-
{% if raises.annotation %}
{% with expression = raises.annotation %}
{% include "expression.html" with context %}
@@ -56,13 +56,13 @@
- | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for raises in section.value %}
-
+
|
{% with expression = raises.annotation %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
index 77d83c0b..e03e8b8e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
@@ -5,7 +5,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Receives:") }}
+ {{ section.title or lang.t("Receives:") }}
@@ -16,7 +16,7 @@
{% for receives in section.value %}
-
+
{% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
{% if receives.annotation %}
@@ -37,10 +37,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Receives:") }}
+ {{ section.title or lang.t("Receives:") }}
{% for receives in section.value %}
- -
+
-
{% if receives.name %}
{{ receives.name }}{% endif %}
{% if receives.annotation %}
{% with expression = receives.annotation %}
@@ -62,13 +62,13 @@
- | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for receives in section.value %}
-
+
{% if receives.name %}
{{ receives.name }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
index b19917a3..a7a7cb98 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
@@ -5,7 +5,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Returns:") }}
+ {{ section.title or lang.t("Returns:") }}
@@ -16,7 +16,7 @@
{% for returns in section.value %}
-
+
{% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
{% if returns.annotation %}
@@ -37,10 +37,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Returns:") }}
+ {{ section.title or lang.t("Returns:") }}
{% for returns in section.value %}
- -
+
-
{% if returns.name %}
{{ returns.name }}{% endif %}
{% if returns.annotation %}
{% with expression = returns.annotation %}
@@ -62,13 +62,13 @@
- | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION").upper() }} |
+ {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION").upper() }} |
{% for returns in section.value %}
-
+
{% if returns.name %}
{{ returns.name }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
index 8377669f..a9bdae26 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
@@ -4,7 +4,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Warns:") }}
+ {{ section.title or lang.t("Warns:") }}
@@ -14,7 +14,7 @@
{% for warns in section.value %}
-
+
|
{% if warns.annotation %}
{% with expression = warns.annotation %}
@@ -34,10 +34,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Warns:") }}
+ {{ section.title or lang.t("Warns:") }}
{% for warns in section.value %}
- -
+
-
{% if warns.annotation %}
{% with expression = warns.annotation %}
{% include "expression.html" with context %}
@@ -56,13 +56,13 @@
- | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for warns in section.value %}
-
+
|
{% with expression = warns.annotation %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
index c69135ea..6c4cb0b0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
@@ -5,7 +5,7 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
{% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Yields:") }}
+ {{ section.title or lang.t("Yields:") }}
@@ -16,7 +16,7 @@
{% for yields in section.value %}
-
+
{% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
{% if yields.annotation %}
@@ -37,10 +37,10 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Yields:") }}
+ {{ section.title or lang.t("Yields:") }}
{% for yields in section.value %}
- -
+
-
{% if yields.name %}
{{ yields.name }}{% endif %}
{% if yields.annotation %}
{% with expression = yields.annotation %}
@@ -62,13 +62,13 @@
- | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
+ {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
{% for yields in section.value %}
-
+
{% if yields.name %}
{{ yields.name }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/style.css b/src/mkdocstrings_handlers/python/templates/material/style.css
index 805c64c3..154be85d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/style.css
+++ b/src/mkdocstrings_handlers/python/templates/material/style.css
@@ -25,6 +25,11 @@
float: right;
}
+/* Backward-compatibility: docstring section titles in bold. */
+.doc-section-title {
+ font-weight: bold;
+}
+
/* Symbols in Navigation and ToC. */
:root,
[data-md-color-scheme="default"] {
From 9f8456a55b9659d86a42f684d85b69b218226b0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Fri, 12 Apr 2024 17:47:24 +0200
Subject: [PATCH 035/243] docs: Improve docs about CSS customization
Issue-48: https://github.com/mkdocstrings/python/issues/48
---
docs/usage/customization.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/docs/usage/customization.md b/docs/usage/customization.md
index 2567870e..8eedadd1 100644
--- a/docs/usage/customization.md
+++ b/docs/usage/customization.md
@@ -5,6 +5,26 @@ and/or by overriding templates.
## CSS classes
+Our templates add [CSS](https://www.w3schools.com/Css/) classes to many HTML elements
+to make it possible for users to customize the resulting look and feel.
+
+To add CSS rules and style mkdocstrings' output,
+put them in a CSS file in your docs folder, for example in `docs/css/mkdocstrings.css`,
+and reference this file in [MkDocs' `extra_css` configuration option](https://www.mkdocs.org/user-guide/configuration/#extra_css):
+
+```yaml title="mkdocs.yml"
+extra_css:
+- css/mkdocstrings.css
+```
+
+Example:
+
+```css title="docs/css/mkdocstrings.css"
+.doc-section-title {
+ font-weight: bold;
+}
+```
+
The following CSS classes are used in the generated HTML:
- `doc`: on all the following elements
@@ -22,6 +42,8 @@ The following CSS classes are used in the generated HTML:
- `doc-labels`: on `span`s wrapping the object's labels
- `doc-label`: on `small` elements containing a label
- `doc-label-LABEL`: same, where `LABEL` is replaced by the actual label
+- `doc-section-title`: on section titles (depend on the [selected style for section rendering][docstring_style])
+- `doc-section-item`: on section items (depend on the [selected style for section rendering][docstring_style])
- `doc-md-description`: on `div`s containing HTML descriptions converted from Markdown docstrings
- `doc-symbol`: on `code` tags of symbol types
- `doc-symbol-heading`: on symbol types in headings
From 11d81d8e056b7c074eb3a1c47606867156a338fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Fri, 19 Apr 2024 15:06:16 +0200
Subject: [PATCH 036/243] fix: Render enumeration instance name instead of just
"value", allowing proper cross-reference
Issue-124: https://github.com/mkdocstrings/python/issues/124
---
pyproject.toml | 2 +-
.../python/templates/material/_base/expression.html | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 1ce73547..c02461f1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,7 +29,7 @@ classifiers = [
]
dependencies = [
"mkdocstrings>=0.24.2",
- "griffe>=0.37",
+ "griffe>=0.44",
]
[project.urls]
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
index cbc84e43..00e1c761 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
@@ -29,7 +29,11 @@
{{ render(expression.slice.elements[0], annotations_path) }}
{%- elif expression.classname == "ExprAttribute" -%}
{%- if annotations_path == "brief" -%}
- {{ render(expression.last, "brief") }}
+ {%- if expression.last.is_enum_value -%}
+ {{ crossref(expression.last.parent, "brief") }}.value
+ {%- else -%}
+ {{ render(expression.last, "brief") }}
+ {%- endif -%}
{%- elif annotations_path == "full" -%}
{{ render(expression.first, "full") }}
{%- for element in expression -%}
From 98e9796fe8ab6eee1ea0a16f1179a0e4f37bcf4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Fri, 19 Apr 2024 15:10:31 +0200
Subject: [PATCH 037/243] chore: Prepare release 1.10.0
---
CHANGELOG.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0e9c966..1fdbdf36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [1.10.0](https://github.com/mkdocstrings/python/releases/tag/1.10.0) - 2024-04-19
+
+[Compare with 1.9.2](https://github.com/mkdocstrings/python/compare/1.9.2...1.10.0)
+
+### Features
+
+- Add CSS classes `doc-section-title` and `doc-section-item` in docstring sections ([d6e1d68](https://github.com/mkdocstrings/python/commit/d6e1d68c099e61c3bd6d93e583708335d84158f5) by Timothée Mazzucotelli). [Issue-17](https://github.com/mkdocstrings/python/issues/17)
+
+### Bug Fixes
+
+- Render enumeration instance name instead of just "value", allowing proper cross-reference ([11d81d8](https://github.com/mkdocstrings/python/commit/11d81d8e056b7c074eb3a1c47606867156a338fa) by Timothée Mazzucotelli). [Issue-124](https://github.com/mkdocstrings/python/issues/124)
+
## [1.9.2](https://github.com/mkdocstrings/python/releases/tag/1.9.2) - 2024-04-02
[Compare with 1.9.1](https://github.com/mkdocstrings/python/compare/1.9.1...1.9.2)
From da02284f96cb9bcd412ca34864c569672b949f35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Wed, 24 Apr 2024 14:56:41 +0200
Subject: [PATCH 038/243] style: Improve templates indentation
---
.../templates/material/_base/attribute.html | 124 ++++-----
.../templates/material/_base/children.html | 56 ++---
.../templates/material/_base/class.html | 236 +++++++++---------
.../material/_base/docstring/attributes.html | 148 +++++------
.../material/_base/docstring/classes.html | 102 ++++----
.../material/_base/docstring/functions.html | 116 ++++-----
.../material/_base/docstring/modules.html | 102 ++++----
.../_base/docstring/other_parameters.html | 148 +++++------
.../material/_base/docstring/parameters.html | 194 +++++++-------
.../material/_base/docstring/raises.html | 134 +++++-----
.../material/_base/docstring/receives.html | 166 ++++++------
.../material/_base/docstring/returns.html | 166 ++++++------
.../material/_base/docstring/warns.html | 134 +++++-----
.../material/_base/docstring/yields.html | 166 ++++++------
.../templates/material/_base/function.html | 154 ++++++------
.../templates/material/_base/module.html | 118 ++++-----
.../templates/material/_base/signature.html | 81 +++---
.../readthedocs/docstring/returns.html | 42 ++--
18 files changed, 1193 insertions(+), 1194 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
index 3f1d887e..80a75fc9 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
@@ -1,80 +1,80 @@
{{ log.debug("Rendering " + attribute.path) }}
-{% with obj = attribute, html_id = attribute.path %}
+ {% with obj = attribute, html_id = attribute.path %}
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set attribute_name = attribute.path if show_full_path else attribute.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
+ ) %}
- {% set attribute_name = attribute.path if show_full_path else attribute.name %}
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ attribute_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
+ {% if attribute.value %} = {{ attribute.value }}{% endif %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="data" if attribute.parent.kind.value == "module" else "attr",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
- ) %}
+ {% block labels scoped %}
+ {% with labels = attribute.labels %}
+ {% include "labels.html" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
+ {% block signature scoped %}
{% if config.separate_signature %}
- {{ attribute_name }}
- {% else %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
- {% if attribute.value %} = {{ attribute.value }}{% endif %}
+ {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ attribute.name }}
{% endfilter %}
{% endif %}
- {% endblock heading %}
+ {% endblock signature %}
- {% block labels scoped %}
- {% with labels = attribute.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
+ {% else %}
- {% endfilter %}
-
- {% block signature scoped %}
- {% if config.separate_signature %}
- {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ attribute.name }}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
+ hidden=True,
+ ) %}
{% endfilter %}
{% endif %}
- {% endblock signature %}
-
- {% else %}
-
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="data" if attribute.parent.kind.value == "module" else "attr",
- id=html_id,
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
- hidden=True,
- ) %}
- {% endfilter %}
+ {% set heading_level = heading_level - 1 %}
{% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = attribute.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
- {% endblock contents %}
-
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = attribute.docstring.parsed %}
+ {% include "docstring.html" with context %}
+ {% endwith %}
+ {% endblock docstring %}
+ {% endblock contents %}
+
-{% endwith %}
+ {% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html b/src/mkdocstrings_handlers/python/templates/material/_base/children.html
index 25534f70..cd9a8fac 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html
@@ -20,11 +20,11 @@
{% endif %}
{% with attributes = obj.attributes|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
{% if attributes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
@@ -40,11 +40,11 @@
{% endwith %}
{% with classes = obj.classes|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
{% if classes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
@@ -60,11 +60,11 @@
{% endwith %}
{% with functions = obj.functions|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
{% if functions %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
@@ -83,11 +83,11 @@
{% if config.show_submodules %}
{% with modules = obj.modules|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
{% if modules %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
@@ -108,14 +108,14 @@
{% else %}
{% for child in obj.all_members
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members(config.members_order, members_list)
- %}
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members(config.members_order, members_list)
+ %}
{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html b/src/mkdocstrings_handlers/python/templates/material/_base/class.html
index fb7ca764..2934c7c0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html
@@ -1,142 +1,142 @@
{{ log.debug("Rendering " + class.path) }}
-{% with obj = class, html_id = class.path %}
+ {% with obj = class, html_id = class.path %}
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set class_name = class.path if show_full_path else class.name %}
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="class",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
- ) %}
+ {% set class_name = class.path if show_full_path else class.name %}
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ class_name }}
- {% elif config.merge_init_into_class and "__init__" in class.all_members %}
- {% with function = class.all_members["__init__"] %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ class_name }}{% include "signature.html" with context %}
- {% endfilter %}
- {% endwith %}
- {% else %}
- {{ class_name }}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = class.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="class",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ ) %}
- {% endfilter %}
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name }}{% include "signature.html" with context %}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
- {% block signature scoped %}
- {% if config.separate_signature and config.merge_init_into_class %}
- {% if "__init__" in class.all_members %}
- {% with function = class.all_members["__init__"] %}
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ class.name }}
- {% endfilter %}
+ {% block labels scoped %}
+ {% with labels = class.labels %}
+ {% include "labels.html" with context %}
{% endwith %}
- {% endif %}
- {% endif %}
- {% endblock signature %}
+ {% endblock labels %}
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="class",
- id=html_id,
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
- hidden=True,
- ) %}
{% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- {% block contents scoped %}
- {% block bases scoped %}
- {% if config.show_bases and class.bases %}
-
- Bases: {% for expression in class.bases -%}
- {% include "expression.html" with context %}{% if not loop.last %}, {% endif %}
- {% endfor -%}
-
- {% endif %}
- {% endblock bases %}
- {% block docstring scoped %}
- {% with docstring_sections = class.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% if config.merge_init_into_class %}
- {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
- {% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
- {% include "docstring.html" with context %}
+ {% block signature scoped %}
+ {% if config.separate_signature and config.merge_init_into_class %}
+ {% if "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
{% endwith %}
{% endif %}
{% endif %}
- {% endblock docstring %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="class",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
- {% block source scoped %}
- {% if config.show_source %}
+
+ {% block contents scoped %}
+ {% block bases scoped %}
+ {% if config.show_bases and class.bases %}
+
+ Bases: {% for expression in class.bases -%}
+ {% include "expression.html" with context %}{% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ {% endif %}
+ {% endblock bases %}
+
+ {% block docstring scoped %}
+ {% with docstring_sections = class.docstring.parsed %}
+ {% include "docstring.html" with context %}
+ {% endwith %}
{% if config.merge_init_into_class %}
- {% if "__init__" in class.all_members and class.all_members["__init__"].source %}
- {% with init = class.all_members["__init__"] %}
-
- Source code in
- {%- if init.relative_filepath.is_absolute() -%}
- {{ init.relative_package_filepath }}
- {%- else -%}
- {{ init.relative_filepath }}
- {%- endif -%}
-
- {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }}
-
+ {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
+ {% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
+ {% include "docstring.html" with context %}
{% endwith %}
{% endif %}
- {% elif class.source %}
-
- Source code in
- {%- if class.relative_filepath.is_absolute() -%}
- {{ class.relative_package_filepath }}
- {%- else -%}
- {{ class.relative_filepath }}
- {%- endif -%}
-
- {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
-
{% endif %}
- {% endif %}
- {% endblock source %}
+ {% endblock docstring %}
+
+ {% block source scoped %}
+ {% if config.show_source %}
+ {% if config.merge_init_into_class %}
+ {% if "__init__" in class.all_members and class.all_members["__init__"].source %}
+ {% with init = class.all_members["__init__"] %}
+
+ Source code in
+ {%- if init.relative_filepath.is_absolute() -%}
+ {{ init.relative_package_filepath }}
+ {%- else -%}
+ {{ init.relative_filepath }}
+ {%- endif -%}
+
+ {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }}
+
+ {% endwith %}
+ {% endif %}
+ {% elif class.source %}
+
+ Source code in
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+
+ {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
+
+ {% endif %}
+ {% endif %}
+ {% endblock source %}
- {% block children scoped %}
- {% set root = False %}
- {% set heading_level = heading_level + 1 %}
- {% include "children.html" with context %}
- {% endblock children %}
- {% endblock contents %}
-
+ {% block children scoped %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "children.html" with context %}
+ {% endblock children %}
+ {% endblock contents %}
+
-{% endwith %}
+ {% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
index 771a9eed..99824653 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
@@ -4,87 +4,87 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for attribute in section.value %}
-
- {{ attribute.name }} |
-
- {% if attribute.annotation %}
- {% with expression = attribute.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Attributes:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for attribute in section.value %}
+
+ {{ attribute.name }} |
+
+ {% if attribute.annotation %}
+ {% with expression = attribute.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
-
+ {{ section.title or lang.t("Attributes:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for attribute in section.value %}
-
- {{ attribute.name }} |
-
-
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if attribute.annotation %}
-
- TYPE:
- {% with expression = attribute.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
+
+
+
+ | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for attribute in section.value %}
+
+ {{ attribute.name }} |
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if attribute.annotation %}
+
+ TYPE:
+ {% with expression = attribute.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
index 054cf5af..c0acac8a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
@@ -4,64 +4,64 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Classes:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for class in section.value %}
-
- {{ class.name }} |
-
-
- {{ class.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Classes:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for class in section.value %}
+
+ {{ class.name }} |
+
+
+ {{ class.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Classes:") }}
-
+ {{ section.title or lang.t("Classes:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for class in section.value %}
-
- {{ class.name }} |
-
-
- {{ class.description|convert_markdown(heading_level, html_id) }}
-
- |
+
+
+
+ | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for class in section.value %}
+
+ {{ class.name }} |
+
+
+ {{ class.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
index a16917bd..696826f0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
@@ -4,70 +4,70 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for function in section.value %}
- {% if not function.name == "__init__" or not config.merge_init_into_class %}
-
- {{ function.name }} |
-
-
- {{ function.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endif %}
- {% endfor %}
-
-
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for function in section.value %}
+ {% if not function.name == "__init__" or not config.merge_init_into_class %}
+
+ {{ function.name }} |
+
+
+ {{ function.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+
{% for function in section.value %}
{% if not function.name == "__init__" or not config.merge_init_into_class %}
-
- {{ function.name }} |
-
-
- {{ function.description|convert_markdown(heading_level, html_id) }}
-
- |
-
+ -
+
{{ function.name }}
+ –
+
+ {{ function.description|convert_markdown(heading_level, html_id) }}
+
+
{% endif %}
{% endfor %}
-
-
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for function in section.value %}
+ {% if not function.name == "__init__" or not config.merge_init_into_class %}
+
+ {{ function.name }} |
+
+
+ {{ function.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
index 26b38257..d5ea77e6 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
@@ -4,64 +4,64 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Modules:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for module in section.value %}
-
- {{ module.name }} |
-
-
- {{ module.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Modules:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for module in section.value %}
+
+ {{ module.name }} |
+
+
+ {{ module.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Modules:") }}
-
+ {{ section.title or lang.t("Modules:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for module in section.value %}
-
- {{ module.name }} |
-
-
- {{ module.description|convert_markdown(heading_level, html_id) }}
-
- |
+
+
+
+ | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for module in section.value %}
+
+ {{ module.name }} |
+
+
+ {{ module.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
index f31836a8..17d6d355 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
@@ -4,87 +4,87 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Other Parameters:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
-
+ {{ section.title or lang.t("Other Parameters:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if parameter.annotation %}
-
- {{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
+
+
+
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
index 05bdadee..7980096d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
@@ -4,110 +4,110 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
- {{ lang.t("Default") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% if parameter.default %}
- {% with expression = parameter.default %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% else %}
- {{ lang.t("required") }}
- {% endif %}
- |
+ {{ section.title or lang.t("Parameters:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+ {{ lang.t("Default") }} |
- {% endfor %}
-
-
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% if parameter.default %}
+ {% with expression = parameter.default %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% else %}
+ {{ lang.t("required") }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
-
+ {{ section.title or lang.t("Parameters:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if parameter.annotation %}
-
- {{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- {% if parameter.default %}
-
- {{ lang.t("DEFAULT:") }}
- {% with expression = parameter.default %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
+
+
+
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ {% endif %}
+ {% if parameter.default %}
+
+ {{ lang.t("DEFAULT:") }}
+ {% with expression = parameter.default %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
index 5e20b653..8240dc09 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
@@ -4,80 +4,80 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Raises:") }}
-
-
-
- | {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for raises in section.value %}
-
-
- {% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ raises.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Raises:") }}
+
+
+
+ | {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for raises in section.value %}
+
+
+ {% if raises.annotation %}
+ {% with expression = raises.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ lang.t(section.title) or lang.t("Raises:") }}
-
+ {{ lang.t(section.title) or lang.t("Raises:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for raises in section.value %}
-
-
-
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
-
-
- {{ raises.description|convert_markdown(heading_level, html_id) }}
-
- |
+
+
+
+ | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for raises in section.value %}
+
+
+
+ {% with expression = raises.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
index e03e8b8e..1eff98ae 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
@@ -4,100 +4,100 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Receives:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for receives in section.value %}
-
- {% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
-
- {% if receives.annotation %}
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ receives.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Receives:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for receives in section.value %}
+
+ {% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
+
+ {% if receives.annotation %}
+ {% with expression = receives.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Receives:") }}
-
+ {{ section.title or lang.t("Receives:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for receives in section.value %}
-
-
- {% if receives.name %}
- {{ receives.name }}
- {% elif receives.annotation %}
-
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ receives.description|convert_markdown(heading_level, html_id) }}
-
- {% if receives.name and receives.annotation %}
-
+
+
+
+ | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for receives in section.value %}
+
+
+ {% if receives.name %}
+ {{ receives.name }}
+ {% elif receives.annotation %}
- {{ lang.t("TYPE:") }}
{% with expression = receives.annotation %}
{% include "expression.html" with context %}
{% endwith %}
-
- {% endif %}
- |
-
- {% endfor %}
-
-
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
+
+ {% if receives.name and receives.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = receives.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
index a7a7cb98..bf3bdb4b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
@@ -4,100 +4,100 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Returns:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for returns in section.value %}
-
- {% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
-
- {% if returns.annotation %}
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ returns.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Returns:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for returns in section.value %}
+
+ {% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
+
+ {% if returns.annotation %}
+ {% with expression = returns.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Returns:") }}
-
+ {{ section.title or lang.t("Returns:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION").upper() }} |
-
-
-
- {% for returns in section.value %}
-
-
- {% if returns.name %}
- {{ returns.name }}
- {% elif returns.annotation %}
-
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ returns.description|convert_markdown(heading_level, html_id) }}
-
- {% if returns.name and returns.annotation %}
-
+
+
+
+ | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION").upper() }} |
+
+
+
+ {% for returns in section.value %}
+
+
+ {% if returns.name %}
+ {{ returns.name }}
+ {% elif returns.annotation %}
- {{ lang.t("TYPE:") }}
{% with expression = returns.annotation %}
{% include "expression.html" with context %}
{% endwith %}
-
- {% endif %}
- |
-
- {% endfor %}
-
-
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
+
+ {% if returns.name and returns.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = returns.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
index a9bdae26..f7883a7a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
@@ -4,80 +4,80 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {{ section.title or lang.t("Warns:") }}
-
-
-
- | {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for warns in section.value %}
-
-
- {% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ warns.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {{ section.title or lang.t("Warns:") }}
+
+
+
+ | {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for warns in section.value %}
+
+
+ {% if warns.annotation %}
+ {% with expression = warns.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Warns:") }}
-
+ {{ section.title or lang.t("Warns:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for warns in section.value %}
-
-
-
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
-
-
- {{ warns.description|convert_markdown(heading_level, html_id) }}
-
- |
+
+
+
+ | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
- {% endfor %}
-
-
+
+
+ {% for warns in section.value %}
+
+
+
+ {% with expression = warns.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
index 6c4cb0b0..2a4bb734 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
@@ -4,100 +4,100 @@
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Yields:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for yields in section.value %}
-
- {% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
-
- {% if yields.annotation %}
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ yields.description|convert_markdown(heading_level, html_id) }}
-
- |
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Yields:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
- {% endfor %}
-
-
+
+
+ {% for yields in section.value %}
+
+ {% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
+
+ {% if yields.annotation %}
+ {% with expression = yields.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
- {{ section.title or lang.t("Yields:") }}
-
+ {{ section.title or lang.t("Yields:") }}
+
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for yields in section.value %}
-
-
- {% if yields.name %}
- {{ yields.name }}
- {% elif yields.annotation %}
-
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ yields.description|convert_markdown(heading_level, html_id) }}
-
- {% if yields.name and yields.annotation %}
-
+
+
+
+ | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for yields in section.value %}
+
+
+ {% if yields.name %}
+ {{ yields.name }}
+ {% elif yields.annotation %}
- {{ lang.t("TYPE:") }}:
{% with expression = yields.annotation %}
{% include "expression.html" with context %}
{% endwith %}
-
- {% endif %}
- |
-
- {% endfor %}
-
-
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
+
+ {% if yields.name and yields.annotation %}
+
+
+ {{ lang.t("TYPE:") }}:
+ {% with expression = yields.annotation %}
+ {% include "expression.html" with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
{% endblock spacy_style %}
{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
index 5c2ac29e..c4a20a12 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
@@ -3,96 +3,96 @@
{% import "language.html" as lang with context %}
-{% with obj = function, html_id = function.path %}
+ {% with obj = function, html_id = function.path %}
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set function_name = function.path if show_full_path else function.name %}
+ {% set symbol_type = "method" if function.parent.is_class else "function" %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="function",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ ) %}
- {% set function_name = function.path if show_full_path else function.name %}
- {% set symbol_type = "method" if function.parent.is_class else "function" %}
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ function_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ function_name }}{% include "signature.html" with context %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="function",
- id=html_id,
- class="doc doc-heading",
- toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
- ) %}
+ {% block labels scoped %}
+ {% with labels = function.labels %}
+ {% include "labels.html" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
+ {% block signature scoped %}
{% if config.separate_signature %}
- {{ function_name }}
- {% else %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ function_name }}{% include "signature.html" with context %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ function.name }}
{% endfilter %}
{% endif %}
- {% endblock heading %}
+ {% endblock signature %}
- {% block labels scoped %}
- {% with labels = function.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
+ {% else %}
- {% endfilter %}
-
- {% block signature scoped %}
- {% if config.separate_signature %}
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ function.name }}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(
+ heading_level,
+ role="function",
+ id=html_id,
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ hidden=True,
+ ) %}
{% endfilter %}
{% endif %}
- {% endblock signature %}
-
- {% else %}
-
- {% if config.show_root_toc_entry %}
- {% filter heading(
- heading_level,
- role="function",
- id=html_id,
- toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
- hidden=True,
- ) %}
- {% endfilter %}
+ {% set heading_level = heading_level - 1 %}
{% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = function.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = function.docstring.parsed %}
+ {% include "docstring.html" with context %}
+ {% endwith %}
+ {% endblock docstring %}
- {% block source scoped %}
- {% if config.show_source and function.source %}
-
- {{ lang.t("Source code in") }}
- {%- if function.relative_filepath.is_absolute() -%}
- {{ function.relative_package_filepath }}
- {%- else -%}
- {{ function.relative_filepath }}
- {%- endif -%}
-
- {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
-
- {% endif %}
- {% endblock source %}
- {% endblock contents %}
-
+ {% block source scoped %}
+ {% if config.show_source and function.source %}
+
+ {{ lang.t("Source code in") }}
+ {%- if function.relative_filepath.is_absolute() -%}
+ {{ function.relative_package_filepath }}
+ {%- else -%}
+ {{ function.relative_filepath }}
+ {%- endif -%}
+
+ {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
+
+ {% endif %}
+ {% endblock source %}
+ {% endblock contents %}
+
-{% endwith %}
+ {% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
index 7d45e321..5c3080c6 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
@@ -1,74 +1,74 @@
{{ log.debug("Rendering " + module.path) }}
-{% with obj = module, html_id = module.path %}
+ {% with obj = module, html_id = module.path %}
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set module_name = module.path if show_full_path else module.name %}
-
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="module",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
- ) %}
-
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ module_name }}
- {% else %}
- {{ module_name }}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = module.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
- {% endfilter %}
+ {% set module_name = module.path if show_full_path else module.name %}
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
role="module",
id=html_id,
+ class="doc doc-heading",
toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
- hidden=True,
- ) %}
+ ) %}
+
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ module_name }}
+ {% else %}
+ {{ module_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {% with labels = module.labels %}
+ {% include "labels.html" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
{% endfilter %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="module",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
{% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = module.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = module.docstring.parsed %}
+ {% include "docstring.html" with context %}
+ {% endwith %}
+ {% endblock docstring %}
- {% block children scoped %}
- {% set root = False %}
- {% set heading_level = heading_level + 1 %}
- {% include "children.html" with context %}
- {% endblock children %}
- {% endblock contents %}
-
+ {% block children scoped %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "children.html" with context %}
+ {% endblock children %}
+ {% endblock contents %}
+
-{% endwith %}
+ {% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
index 74563385..6d3d2973 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
@@ -3,62 +3,61 @@
{%- with -%}
{%- set ns = namespace(
- has_pos_only=False,
- render_pos_only_separator=True,
- render_kw_only_separator=True,
- annotation="",
- equal="=",
- )
- -%}
+ has_pos_only=False,
+ render_pos_only_separator=True,
+ render_kw_only_separator=True,
+ annotation="",
+ equal="=",
+ ) -%}
(
- {%- for parameter in function.parameters -%}
- {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
+ {%- for parameter in function.parameters -%}
+ {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
- {%- if parameter.kind.value == "positional-only" -%}
- {%- set ns.has_pos_only = True -%}
- {%- else -%}
- {%- if ns.has_pos_only and ns.render_pos_only_separator -%}
- {%- set ns.render_pos_only_separator = False %}/, {% endif -%}
- {%- if parameter.kind.value == "keyword-only" -%}
- {%- if ns.render_kw_only_separator -%}
- {%- set ns.render_kw_only_separator = False %}*, {% endif -%}
- {%- endif -%}
+ {%- if parameter.kind.value == "positional-only" -%}
+ {%- set ns.has_pos_only = True -%}
+ {%- else -%}
+ {%- if ns.has_pos_only and ns.render_pos_only_separator -%}
+ {%- set ns.render_pos_only_separator = False %}/, {% endif -%}
+ {%- if parameter.kind.value == "keyword-only" -%}
+ {%- if ns.render_kw_only_separator -%}
+ {%- set ns.render_kw_only_separator = False %}*, {% endif -%}
{%- endif -%}
+ {%- endif -%}
- {%- if config.show_signature_annotations and parameter.annotation is not none -%}
- {%- set ns.equal = " = " -%}
- {%- if config.separate_signature and config.signature_crossrefs -%}
- {%- with expression = parameter.annotation -%}
- {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%}
- {%- endwith -%}
- {%- else -%}
- {%- set ns.annotation = ": " + parameter.annotation|safe -%}
- {%- endif -%}
+ {%- if config.show_signature_annotations and parameter.annotation is not none -%}
+ {%- set ns.equal = " = " -%}
+ {%- if config.separate_signature and config.signature_crossrefs -%}
+ {%- with expression = parameter.annotation -%}
+ {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%}
+ {%- endwith -%}
{%- else -%}
- {%- set ns.equal = "=" -%}
- {%- set ns.annotation = "" -%}
+ {%- set ns.annotation = ": " + parameter.annotation|safe -%}
{%- endif -%}
+ {%- else -%}
+ {%- set ns.equal = "=" -%}
+ {%- set ns.annotation = "" -%}
+ {%- endif -%}
- {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
- {%- set default = ns.equal + parameter.default|safe -%}
- {%- endif -%}
+ {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
+ {%- set default = ns.equal + parameter.default|safe -%}
+ {%- endif -%}
- {%- if parameter.kind.value == "variadic positional" -%}
- {%- set ns.render_kw_only_separator = False -%}
- {%- endif -%}
+ {%- if parameter.kind.value == "variadic positional" -%}
+ {%- set ns.render_kw_only_separator = False -%}
+ {%- endif -%}
- {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%}
- {{ parameter.name }}{{ ns.annotation }}{{ default }}
- {%- if not loop.last %}, {% endif -%}
+ {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%}
+ {{ parameter.name }}{{ ns.annotation }}{{ default }}
+ {%- if not loop.last %}, {% endif -%}
- {%- endif -%}
- {%- endfor -%}
+ {%- endif -%}
+ {%- endfor -%}
)
{%- if config.show_signature_annotations
and function.annotation
and not (config.merge_init_into_class and function.name == "__init__" )
- %} -> {% if config.separate_signature and config.signature_crossrefs -%}
+ %} -> {% if config.separate_signature and config.signature_crossrefs -%}
{%- with expression = function.annotation %}{% include "expression.html" with context %}{%- endwith -%}
{%- else -%}
{{ function.annotation|safe }}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
index c2300318..355eedcc 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
@@ -9,27 +9,27 @@
- | {{ section.title or lang.t("Returns:") }} |
-
-
- |
+ {{ section.title or lang.t("Returns:") }} |
+
+
+ |
|
From 2bc156bd6f231ae13066651f4490d1e9c2ce3ca2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:40:11 +0200
Subject: [PATCH 039/243] build: Depend on mkdocstrings 0.25 which adds support
for parameter `once` when logging messages
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index c02461f1..398d5d3a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,7 +28,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
- "mkdocstrings>=0.24.2",
+ "mkdocstrings>=0.25",
"griffe>=0.44",
]
From 26e3d66f5334a5aaff75bda030afe6dfa1cc94d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:42:09 +0200
Subject: [PATCH 040/243] refactor: Log a warning when base templates are
overridden
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
src/mkdocstrings_handlers/python/handler.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index fa8e384c..03111005 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -9,6 +9,7 @@
import sys
from collections import ChainMap
from contextlib import suppress
+from pathlib import Path
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar, Iterator, Mapping, Sequence
from griffe.collections import LinesCollection, ModulesCollection
@@ -208,6 +209,17 @@ def __init__(
**kwargs: Same thing, but with keyword arguments.
"""
super().__init__(*args, **kwargs)
+
+ # Warn if user overrides base templates.
+ if custom_templates := kwargs.get("custom_templates", ()):
+ config_dir = Path(config_file_path or "./mkdocs.yml").parent
+ for theme_dir in config_dir.joinpath(custom_templates, "python").iterdir():
+ if theme_dir.joinpath("_base").is_dir():
+ logger.warning(
+ f"Overriding base template '{theme_dir.name}/_base/.html.jinja' is not supported, "
+ f"override '{theme_dir.name}/.html.jinja' instead",
+ )
+
self._config_file_path = config_file_path
self._load_external_modules = load_external_modules
paths = paths or []
From 3546fd70b2d4e45f77b166b2e67c333acc8af0d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:46:06 +0200
Subject: [PATCH 041/243] refactor: Update `get_template` filter to support
both `*.html` and `*.html.jinja` templates, logging a message (info) when
`*.html` templates are overridden by users
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
src/mkdocstrings_handlers/python/handler.py | 2 +-
src/mkdocstrings_handlers/python/rendering.py | 50 ++++++++++++++++---
2 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 03111005..b075f3a7 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -333,7 +333,7 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> CollectorItem:
def render(self, data: CollectorItem, config: Mapping[str, Any]) -> str: # noqa: D102 (ignore missing docstring)
final_config = ChainMap(config, self.default_config) # type: ignore[arg-type]
- template_name = rendering.do_get_template(data)
+ template_name = rendering.do_get_template(self.env, data)
template = self.env.get_template(template_name)
# Heading level is a "state" variable, that will change at each step
diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py
index 878b74aa..479597c2 100644
--- a/src/mkdocstrings_handlers/python/rendering.py
+++ b/src/mkdocstrings_handlers/python/rendering.py
@@ -9,20 +9,23 @@
import sys
import warnings
from functools import lru_cache, partial
+from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Match, Pattern, Sequence
+from griffe.dataclasses import Alias, Object
from griffe.docstrings.dataclasses import (
DocstringSectionAttributes,
DocstringSectionClasses,
DocstringSectionFunctions,
DocstringSectionModules,
)
-from jinja2 import pass_context
+from jinja2 import TemplateNotFound, pass_context, pass_environment
from markupsafe import Markup
from mkdocstrings.loggers import get_logger
if TYPE_CHECKING:
- from griffe.dataclasses import Alias, Attribute, Class, Function, Module, Object
+ from griffe.dataclasses import Attribute, Class, Function, Module
+ from jinja2 import Environment, Template
from jinja2.runtime import Context
from mkdocstrings.handlers.base import CollectorItem
@@ -137,7 +140,8 @@ def do_format_signature(
The same code, formatted.
"""
env = context.environment
- template = env.get_template("signature.html")
+ # TODO: Stop using `do_get_template` when `*.html` templates are removed.
+ template = env.get_template(do_get_template(env, "signature"))
config_annotations = context.parent["config"]["show_signature_annotations"]
old_stash_ref_filter = env.filters["stash_crossref"]
@@ -204,7 +208,8 @@ def do_format_attribute(
The same code, formatted.
"""
env = context.environment
- template = env.get_template("expression.html")
+ # TODO: Stop using `do_get_template` when `*.html` templates are removed.
+ template = env.get_template(do_get_template(env, "expression"))
annotations = context.parent["config"]["show_signature_annotations"]
separate_signature = context.parent["config"]["separate_signature"]
old_stash_ref_filter = env.filters["stash_crossref"]
@@ -448,17 +453,46 @@ def formatter(code: str, line_length: int) -> str:
return formatter
-def do_get_template(obj: Object) -> str:
+@pass_environment
+def do_get_template(env: Environment, obj: str | Object) -> str | Template:
"""Get the template name used to render an object.
Parameters:
- obj: A Griffe object.
+ env: The Jinja environment, passed automatically.
+ obj: A Griffe object, or a template name.
Returns:
A template name.
"""
- extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
- return extra_data.get("template", "") or f"{obj.kind.value}.html"
+ name = obj
+ if isinstance(obj, (Alias, Object)):
+ extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
+ if name := extra_data.get("template", ""):
+ return name
+ name = obj.kind.value
+ try:
+ template = env.get_template(f"{name}.html")
+ except TemplateNotFound:
+ return f"{name}.html.jinja"
+ else:
+ # TODO: Remove once support for Python 3.8 is dropped.
+ if sys.version_info < (3, 9):
+ try:
+ Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type]
+ except ValueError:
+ our_template = False
+ else:
+ our_template = True
+ else:
+ our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
+ if not our_template:
+ # TODO: Switch to a warning log after some time.
+ logger.info(
+ f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. "
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ )
+ return f"{name}.html"
@pass_context
From eced9a54fc8a559b686cb1b1180a0d2e04ba452d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:49:36 +0200
Subject: [PATCH 042/243] refactor: Add `*.html.jinja` base templates, which
are copies of `*.html` templates, with an additional `logs` block, and using
the updated `get_template` filter
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
.../material/_base/attribute.html.jinja | 82 +++++++++
.../material/_base/children.html.jinja | 156 ++++++++++++++++++
.../templates/material/_base/class.html.jinja | 144 ++++++++++++++++
.../material/_base/docstring.html.jinja | 36 ++++
.../_base/docstring/admonition.html.jinja | 7 +
.../_base/docstring/attributes.html.jinja | 92 +++++++++++
.../_base/docstring/classes.html.jinja | 69 ++++++++
.../_base/docstring/examples.html.jinja | 14 ++
.../_base/docstring/functions.html.jinja | 75 +++++++++
.../_base/docstring/modules.html.jinja | 69 ++++++++
.../docstring/other_parameters.html.jinja | 92 +++++++++++
.../_base/docstring/parameters.html.jinja | 115 +++++++++++++
.../_base/docstring/raises.html.jinja | 85 ++++++++++
.../_base/docstring/receives.html.jinja | 105 ++++++++++++
.../_base/docstring/returns.html.jinja | 105 ++++++++++++
.../material/_base/docstring/warns.html.jinja | 85 ++++++++++
.../_base/docstring/yields.html.jinja | 105 ++++++++++++
.../material/_base/expression.html.jinja | 59 +++++++
.../material/_base/function.html.jinja | 100 +++++++++++
.../material/_base/labels.html.jinja | 10 ++
.../material/_base/language.html.jinja | 12 ++
.../material/_base/languages/en.html.jinja | 39 +++++
.../material/_base/languages/ja.html.jinja | 39 +++++
.../material/_base/languages/zh.html.jinja | 39 +++++
.../material/_base/module.html.jinja | 76 +++++++++
.../material/_base/signature.html.jinja | 70 ++++++++
.../material/_base/summary.html.jinja | 2 +
.../_base/summary/attributes.html.jinja | 2 +
.../material/_base/summary/classes.html.jinja | 2 +
.../_base/summary/functions.html.jinja | 2 +
.../material/_base/summary/modules.html.jinja | 2 +
.../_base/docstring/attributes.html.jinja | 35 ++++
.../docstring/other_parameters.html.jinja | 35 ++++
.../_base/docstring/parameters.html.jinja | 40 +++++
.../_base/docstring/raises.html.jinja | 34 ++++
.../_base/docstring/receives.html.jinja | 37 +++++
.../_base/docstring/returns.html.jinja | 37 +++++
.../_base/docstring/warns.html.jinja | 34 ++++
.../_base/docstring/yields.html.jinja | 37 +++++
.../readthedocs/_base/language.html.jinja | 12 ++
.../readthedocs/_base/languages/en.html.jinja | 39 +++++
.../readthedocs/_base/languages/ja.html.jinja | 39 +++++
.../readthedocs/_base/languages/zh.html.jinja | 39 +++++
43 files changed, 2308 insertions(+)
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html.jinja
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
new file mode 100644
index 00000000..fd537034
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
@@ -0,0 +1,82 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering " + attribute.path) }}
+{% endblock logs %}
+
+
+ {% with obj = attribute, html_id = attribute.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set attribute_name = attribute.path if show_full_path else attribute.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
+ ) %}
+
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ attribute_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
+ {% if attribute.value %} = {{ attribute.value }}{% endif %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {% with labels = attribute.labels %}
+ {% include "labels"|get_template with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {% if config.separate_signature %}
+ {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ attribute.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = attribute.docstring.parsed %}
+ {% include "docstring"|get_template with context %}
+ {% endwith %}
+ {% endblock docstring %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
new file mode 100644
index 00000000..b63b9a6a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
@@ -0,0 +1,156 @@
+{% if obj.members %}
+ {% block logs scoped %}
+ {{ log.debug("Rendering children of " + obj.path) }}
+ {% endblock logs %}
+
+
+
+ {% if root_members %}
+ {% set members_list = config.members %}
+ {% else %}
+ {% set members_list = none %}
+ {% endif %}
+
+ {% if config.group_by_category %}
+
+ {% with %}
+
+ {% if config.show_category_heading %}
+ {% set extra_level = 1 %}
+ {% else %}
+ {% set extra_level = 0 %}
+ {% endif %}
+
+ {% with attributes = obj.attributes|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% if attributes %}
+ {% if config.show_category_heading %}
+ {% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
+ {% endif %}
+ {% with heading_level = heading_level + extra_level %}
+ {% for attribute in attributes|order_members(config.members_order, members_list) %}
+ {% if members_list is not none or attribute.is_public(check_name=False) %}
+ {% include attribute|get_template with context %}
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+
+ {% with classes = obj.classes|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% if classes %}
+ {% if config.show_category_heading %}
+ {% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
+ {% endif %}
+ {% with heading_level = heading_level + extra_level %}
+ {% for class in classes|order_members(config.members_order, members_list) %}
+ {% if members_list is not none or class.is_public(check_name=False) %}
+ {% include class|get_template with context %}
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+
+ {% with functions = obj.functions|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% if functions %}
+ {% if config.show_category_heading %}
+ {% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
+ {% endif %}
+ {% with heading_level = heading_level + extra_level %}
+ {% for function in functions|order_members(config.members_order, members_list) %}
+ {% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %}
+ {% if members_list is not none or function.is_public(check_name=False) %}
+ {% include function|get_template with context %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+
+ {% if config.show_submodules %}
+ {% with modules = obj.modules|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% if modules %}
+ {% if config.show_category_heading %}
+ {% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
+ {% endif %}
+ {% with heading_level = heading_level + extra_level %}
+ {% for module in modules|order_members(config.members_order.alphabetical, members_list) %}
+ {% if members_list is not none or module.is_public(check_name=False) %}
+ {% include module|get_template with context %}
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+ {% endif %}
+
+ {% endwith %}
+
+ {% else %}
+
+ {% for child in obj.all_members
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members(config.members_order, members_list)
+ %}
+
+ {% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
+
+ {% if members_list is not none or child.is_public(check_name=False) %}
+ {% if child.is_attribute %}
+ {% with attribute = child %}
+ {% include attribute|get_template with context %}
+ {% endwith %}
+
+ {% elif child.is_class %}
+ {% with class = child %}
+ {% include class|get_template with context %}
+ {% endwith %}
+
+ {% elif child.is_function %}
+ {% with function = child %}
+ {% include function|get_template with context %}
+ {% endwith %}
+
+ {% elif child.is_module and config.show_submodules %}
+ {% with module = child %}
+ {% include module|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+ {% endif %}
+
+ {% endif %}
+
+ {% endfor %}
+
+ {% endif %}
+
+
+
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
new file mode 100644
index 00000000..2bfa2bf0
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
@@ -0,0 +1,144 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering " + class.path) }}
+{% endblock logs %}
+
+
+ {% with obj = class, html_id = class.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set class_name = class.path if show_full_path else class.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="class",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ ) %}
+
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name }}{% include "signature"|get_template with context %}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {% with labels = class.labels %}
+ {% include "labels"|get_template with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {% if config.separate_signature and config.merge_init_into_class %}
+ {% if "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
+ {% endwith %}
+ {% endif %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="class",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {% block bases scoped %}
+ {% if config.show_bases and class.bases %}
+
+ Bases: {% for expression in class.bases -%}
+ {% include "expression"|get_template with context %}{% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ {% endif %}
+ {% endblock bases %}
+
+ {% block docstring scoped %}
+ {% with docstring_sections = class.docstring.parsed %}
+ {% include "docstring"|get_template with context %}
+ {% endwith %}
+ {% if config.merge_init_into_class %}
+ {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
+ {% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
+ {% include "docstring"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ {% endif %}
+ {% endblock docstring %}
+
+ {% block source scoped %}
+ {% if config.show_source %}
+ {% if config.merge_init_into_class %}
+ {% if "__init__" in class.all_members and class.all_members["__init__"].source %}
+ {% with init = class.all_members["__init__"] %}
+
+ Source code in
+ {%- if init.relative_filepath.is_absolute() -%}
+ {{ init.relative_package_filepath }}
+ {%- else -%}
+ {{ init.relative_filepath }}
+ {%- endif -%}
+
+ {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }}
+
+ {% endwith %}
+ {% endif %}
+ {% elif class.source %}
+
+ Source code in
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+
+ {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
+
+ {% endif %}
+ {% endif %}
+ {% endblock source %}
+
+ {% block children scoped %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "children"|get_template with context %}
+ {% endblock children %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
new file mode 100644
index 00000000..8477dc0a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
@@ -0,0 +1,36 @@
+{% if docstring_sections %}
+ {% block logs scoped %}
+ {{ log.debug("Rendering docstring") }}
+ {% endblock logs %}
+ {% for section in docstring_sections %}
+ {% if config.show_docstring_description and section.kind.value == "text" %}
+ {{ section.value|convert_markdown(heading_level, html_id) }}
+ {% elif config.show_docstring_attributes and section.kind.value == "attributes" %}
+ {% include "docstring/attributes"|get_template with context %}
+ {% elif config.show_docstring_functions and section.kind.value == "functions" %}
+ {% include "docstring/functions"|get_template with context %}
+ {% elif config.show_docstring_classes and section.kind.value == "classes" %}
+ {% include "docstring/classes"|get_template with context %}
+ {% elif config.show_docstring_modules and section.kind.value == "modules" %}
+ {% include "docstring/modules"|get_template with context %}
+ {% elif config.show_docstring_parameters and section.kind.value == "parameters" %}
+ {% include "docstring/parameters"|get_template with context %}
+ {% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %}
+ {% include "docstring/other_parameters"|get_template with context %}
+ {% elif config.show_docstring_raises and section.kind.value == "raises" %}
+ {% include "docstring/raises"|get_template with context %}
+ {% elif config.show_docstring_warns and section.kind.value == "warns" %}
+ {% include "docstring/warns"|get_template with context %}
+ {% elif config.show_docstring_yields and section.kind.value == "yields" %}
+ {% include "docstring/yields"|get_template with context %}
+ {% elif config.show_docstring_receives and section.kind.value == "receives" %}
+ {% include "docstring/receives"|get_template with context %}
+ {% elif config.show_docstring_returns and section.kind.value == "returns" %}
+ {% include "docstring/returns"|get_template with context %}
+ {% elif config.show_docstring_examples and section.kind.value == "examples" %}
+ {% include "docstring/examples"|get_template with context %}
+ {% elif config.show_docstring_description and section.kind.value == "admonition" %}
+ {% include "docstring/admonition"|get_template with context %}
+ {% endif %}
+ {% endfor %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
new file mode 100644
index 00000000..b5053342
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
@@ -0,0 +1,7 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering admonition") }}
+{% endblock logs %}
+
+ {{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True) }}
+ {{ section.value.contents|convert_markdown(heading_level, html_id) }}
+
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
new file mode 100644
index 00000000..d1bb3bb0
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
@@ -0,0 +1,92 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering attributes section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Attributes:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for attribute in section.value %}
+
+ {{ attribute.name }} |
+
+ {% if attribute.annotation %}
+ {% with expression = attribute.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Attributes:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for attribute in section.value %}
+
+ {{ attribute.name }} |
+
+
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if attribute.annotation %}
+
+ TYPE:
+ {% with expression = attribute.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
new file mode 100644
index 00000000..60ec7e54
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
@@ -0,0 +1,69 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering classes section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Classes:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for class in section.value %}
+
+ {{ class.name }} |
+
+
+ {{ class.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Classes:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for class in section.value %}
+
+ {{ class.name }} |
+
+
+ {{ class.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
new file mode 100644
index 00000000..1e79a53a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
@@ -0,0 +1,14 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering examples section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{{ section.title or lang.t("Examples:") }}
+{% for section_type, sub_section in section.value %}
+ {% if section_type.value == "text" %}
+ {{ sub_section|convert_markdown(heading_level, html_id) }}
+ {% elif section_type.value == "examples" %}
+ {{ sub_section|highlight(language="pycon", linenums=False) }}
+ {% endif %}
+{% endfor %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja
new file mode 100644
index 00000000..35197c80
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja
@@ -0,0 +1,75 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering functions section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for function in section.value %}
+ {% if not function.name == "__init__" or not config.merge_init_into_class %}
+
+ {{ function.name }} |
+
+
+ {{ function.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for function in section.value %}
+ {% if not function.name == "__init__" or not config.merge_init_into_class %}
+
+ {{ function.name }} |
+
+
+ {{ function.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja
new file mode 100644
index 00000000..fc212db9
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja
@@ -0,0 +1,69 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering modules section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Modules:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for module in section.value %}
+
+ {{ module.name }} |
+
+
+ {{ module.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Modules:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for module in section.value %}
+
+ {{ module.name }} |
+
+
+ {{ module.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
new file mode 100644
index 00000000..c3d4af97
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
@@ -0,0 +1,92 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering other parameters section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Other Parameters:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Other Parameters:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
new file mode 100644
index 00000000..f411e114
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
@@ -0,0 +1,115 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering parameters section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Parameters:") }}
+
+
+
+ | {{ lang.t("Name") }} |
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+ {{ lang.t("Default") }} |
+
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+ {% if parameter.annotation %}
+ {% with expression = parameter.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% if parameter.default %}
+ {% with expression = parameter.default %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% else %}
+ {{ lang.t("required") }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Parameters:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for parameter in section.value %}
+
+ {{ parameter.name }} |
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
+
+
+ {% if parameter.annotation %}
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = parameter.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+ {% if parameter.default %}
+
+ {{ lang.t("DEFAULT:") }}
+ {% with expression = parameter.default %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
new file mode 100644
index 00000000..12ff1496
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
@@ -0,0 +1,85 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering raises section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Raises:") }}
+
+
+
+ | {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for raises in section.value %}
+
+
+ {% if raises.annotation %}
+ {% with expression = raises.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ lang.t(section.title) or lang.t("Raises:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for raises in section.value %}
+
+
+
+ {% with expression = raises.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
new file mode 100644
index 00000000..13e0ea30
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
@@ -0,0 +1,105 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering receives section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Receives:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for receives in section.value %}
+
+ {% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
+
+ {% if receives.annotation %}
+ {% with expression = receives.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Receives:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for receives in section.value %}
+
+
+ {% if receives.name %}
+ {{ receives.name }}
+ {% elif receives.annotation %}
+
+ {% with expression = receives.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
+
+ {% if receives.name and receives.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = receives.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
new file mode 100644
index 00000000..9a330780
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
@@ -0,0 +1,105 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering returns section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Returns:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for returns in section.value %}
+
+ {% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
+
+ {% if returns.annotation %}
+ {% with expression = returns.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Returns:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION").upper() }} |
+
+
+
+ {% for returns in section.value %}
+
+
+ {% if returns.name %}
+ {{ returns.name }}
+ {% elif returns.annotation %}
+
+ {% with expression = returns.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
+
+ {% if returns.name and returns.annotation %}
+
+
+ {{ lang.t("TYPE:") }}
+ {% with expression = returns.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
new file mode 100644
index 00000000..b8ed3851
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
@@ -0,0 +1,85 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering warns section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {{ section.title or lang.t("Warns:") }}
+
+
+
+ | {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for warns in section.value %}
+
+
+ {% if warns.annotation %}
+ {% with expression = warns.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Warns:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for warns in section.value %}
+
+
+
+ {% with expression = warns.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ |
+
+
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
new file mode 100644
index 00000000..6172a254
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
@@ -0,0 +1,105 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering yields section") }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {% set name_column = section.value|selectattr("name")|any %}
+ {{ section.title or lang.t("Yields:") }}
+
+
+
+ {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
+ {{ lang.t("Type") }} |
+ {{ lang.t("Description") }} |
+
+
+
+ {% for yields in section.value %}
+
+ {% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
+
+ {% if yields.annotation %}
+ {% with expression = yields.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
+
+ |
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {{ section.title or lang.t("Yields:") }}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+
+
+
+ | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
+ {{ lang.t("DESCRIPTION") }} |
+
+
+
+ {% for yields in section.value %}
+
+
+ {% if yields.name %}
+ {{ yields.name }}
+ {% elif yields.annotation %}
+
+ {% with expression = yields.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+ {% endif %}
+ |
+
+
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
+
+ {% if yields.name and yields.annotation %}
+
+
+ {{ lang.t("TYPE:") }}:
+ {% with expression = yields.annotation %}
+ {% include "expression"|get_template with context %}
+ {% endwith %}
+
+
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja
new file mode 100644
index 00000000..c219f636
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja
@@ -0,0 +1,59 @@
+{% block logs scoped %}
+{% endblock logs %}
+
+{%- macro crossref(name, annotation_path) -%}
+ {%- with full = name.canonical_path -%}
+ {%- if annotation_path == "brief" -%}
+ {%- set annotation = name.canonical_name -%}
+ {%- elif annotation_path == "source" -%}
+ {%- set annotation = name.name -%}
+ {%- elif annotation_path == "full" -%}
+ {%- set annotation = full -%}
+ {%- endif -%}
+ {%- for title, path in annotation|split_path(full) -%}
+ {%- if not signature or config.signature_crossrefs -%}
+ {%- filter stash_crossref(length=title|length) -%}
+ {{ title }}
+ {%- endfilter -%}
+ {%- else -%}
+ {{ title }}
+ {%- endif -%}
+ {%- if not loop.last -%}.{%- endif -%}
+ {%- endfor -%}
+ {%- endwith -%}
+{%- endmacro -%}
+
+{%- macro render(expression, annotations_path) -%}
+ {%- if expression is string -%}
+ {%- if signature -%}{{ expression|safe }}{%- else -%}{{ expression }}{%- endif -%}
+ {%- elif expression.classname == "ExprName" -%}
+ {{ crossref(expression, annotations_path) }}
+ {%- elif config.unwrap_annotated and expression.classname == "ExprSubscript" and expression.canonical_path in ("typing.Annotated", "typing_extensions.Annotated") -%}
+ {{ render(expression.slice.elements[0], annotations_path) }}
+ {%- elif expression.classname == "ExprAttribute" -%}
+ {%- if annotations_path == "brief" -%}
+ {%- if expression.last.is_enum_value -%}
+ {{ crossref(expression.last.parent, "brief") }}.value
+ {%- else -%}
+ {{ render(expression.last, "brief") }}
+ {%- endif -%}
+ {%- elif annotations_path == "full" -%}
+ {{ render(expression.first, "full") }}
+ {%- for element in expression -%}
+ {%- if not loop.first -%}
+ {{ render(element, "brief") }}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- else -%}
+ {%- for element in expression -%}
+ {{ render(element, annotations_path) }}
+ {%- endfor -%}
+ {%- endif -%}
+ {%- else -%}
+ {%- for element in expression -%}
+ {{ render(element, annotations_path) }}
+ {%- endfor -%}
+ {%- endif -%}
+{%- endmacro -%}
+
+{{ render(expression, config.annotations_path) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
new file mode 100644
index 00000000..c4d0f1fc
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
@@ -0,0 +1,100 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering " + function.path) }}
+{% endblock logs %}
+
+{% import "language"|get_template as lang with context %}
+
+
+ {% with obj = function, html_id = function.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set function_name = function.path if show_full_path else function.name %}
+ {% set symbol_type = "method" if function.parent.is_class else "function" %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="function",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ ) %}
+
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ function_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ function_name }}{% include "signature"|get_template with context %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {% with labels = function.labels %}
+ {% include "labels"|get_template with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {% if config.separate_signature %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ function.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+
+ {% if config.show_root_toc_entry %}
+ {% filter heading(
+ heading_level,
+ role="function",
+ id=html_id,
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = function.docstring.parsed %}
+ {% include "docstring"|get_template with context %}
+ {% endwith %}
+ {% endblock docstring %}
+
+ {% block source scoped %}
+ {% if config.show_source and function.source %}
+
+ {{ lang.t("Source code in") }}
+ {%- if function.relative_filepath.is_absolute() -%}
+ {{ function.relative_package_filepath }}
+ {%- else -%}
+ {{ function.relative_filepath }}
+ {%- endif -%}
+
+ {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
+
+ {% endif %}
+ {% endblock source %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja
new file mode 100644
index 00000000..bcdc112b
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html.jinja
@@ -0,0 +1,10 @@
+{% if config.show_labels and labels %}
+ {% block logs scoped %}
+ {{ log.debug("Rendering labels") }}
+ {% endblock logs %}
+
+ {% for label in labels|sort %}
+ {{ label }}
+ {% endfor %}
+
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
new file mode 100644
index 00000000..dd3fe800
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
@@ -0,0 +1,12 @@
+{% block logs scoped %}
+{% endblock logs %}
+
+{% set lang_pth = "languages/" ~ locale | get_template %}
+{% if lang_pth is existing_template %}
+ {% import lang_pth as lang %}
+ {% import "languages/en"|get_template as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+{% else %}
+ {% import "languages/en"|get_template as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
new file mode 100644
index 00000000..5a771d30
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "ATTRIBUTE",
+ "Attributes:": "Attributes:",
+ "Classes:": "Classes:",
+ "CLASS": "CLASS",
+ "DEFAULT:": "DEFAULT:",
+ "Default": "Default",
+ "default:": "default:",
+ "DESCRIPTION": "DESCRIPTION",
+ "Description": "Description",
+ "Examples:": "Examples:",
+ "Functions:": "Functions:",
+ "FUNCTION": "FUNCTION",
+ "Methods:": "Methods:",
+ "METHOD": "METHOD",
+ "Modules:": "Modules:",
+ "MODULE": "MODULE",
+ "Name": "Name",
+ "Other Parameters:": "Other Parameters:",
+ "PARAMETER": "PARAMETER",
+ "Parameters:": "Parameters:",
+ "RAISES": "RAISES",
+ "Raises:" : "Raises:",
+ "RECEIVES": "RECEIVES",
+ "Receives:": "Receives:",
+ "required": "required",
+ "RETURNS": "RETURNS",
+ "Returns:": "Returns:",
+ "Source code in": "Source code in",
+ "TYPE:": "TYPE:",
+ "Type": "Type",
+ "WARNS": "WARNS",
+ "Warns:": "Warns:",
+ "YIELDS": "YIELDS",
+ "Yields:": "Yields:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
new file mode 100644
index 00000000..748fd8b7
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "Classes:": "",
+ "CLASS": "",
+ "DEFAULT:": "デフォルト:",
+ "Default": "デフォルト",
+ "default:": "デフォルト:",
+ "DESCRIPTION": "デスクリプション",
+ "Description": "デスクリプション",
+ "Examples:": "例:",
+ "Functions:": "",
+ "FUNCTION": "",
+ "Methods:": "",
+ "METHOD": "",
+ "Modules:": "",
+ "MODULE": "",
+ "Name": "名前",
+ "Other Parameters:": "他の引数:",
+ "PARAMETER": "引数",
+ "Parameters:": "引数:",
+ "RAISES": "発生",
+ "Raises:" : "発生:",
+ "RECEIVES": "取得",
+ "Receives:": "取得:",
+ "required": "必須",
+ "RETURNS": "戻り値",
+ "Returns:": "戻り値:",
+ "Source code in": "ソースコード位置:",
+ "TYPE:": "タイプ:",
+ "Type": "タイプ",
+ "WARNS": "警告",
+ "Warns:": "警告:",
+ "YIELDS": "返す",
+ "Yields:": "返す:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
new file mode 100644
index 00000000..772e33cd
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "Classes:": "",
+ "CLASS": "",
+ "DEFAULT:": "默认:",
+ "Default": "默认",
+ "default:": "默认:",
+ "DESCRIPTION": "描述",
+ "Description": "描述",
+ "Examples:": "示例:",
+ "Functions:": "",
+ "FUNCTION": "",
+ "Methods:": "",
+ "METHOD": "",
+ "Modules:": "",
+ "MODULE": "",
+ "Name": "名称",
+ "Other Parameters:": "其他参数:",
+ "PARAMETER": "参数",
+ "Parameters:": "参数:",
+ "RAISES": "引发",
+ "Raises:" : "引发:",
+ "Receives:": "接收:",
+ "RECEIVES": "接收",
+ "required": "必需",
+ "RETURNS": "返回",
+ "Returns:": "返回:",
+ "Source code in": "源代码位于:",
+ "TYPE:": "类型:",
+ "Type": "类型",
+ "Warns:": "警告:",
+ "WARNS": "警告",
+ "YIELDS": "产生",
+ "Yields:": "产生:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
new file mode 100644
index 00000000..02665e20
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
@@ -0,0 +1,76 @@
+{% block logs scoped %}
+ {{ log.debug("Rendering " + module.path) }}
+{% endblock logs %}
+
+
+ {% with obj = module, html_id = module.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set module_name = module.path if show_full_path else module.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="module",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
+ ) %}
+
+ {% block heading scoped %}
+ {% if config.show_symbol_type_heading %} {% endif %}
+ {% if config.separate_signature %}
+ {{ module_name }}
+ {% else %}
+ {{ module_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {% with labels = module.labels %}
+ {% include "labels"|get_template with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="module",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {% block docstring scoped %}
+ {% with docstring_sections = module.docstring.parsed %}
+ {% include "docstring"|get_template with context %}
+ {% endwith %}
+ {% endblock docstring %}
+
+ {% block children scoped %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "children"|get_template with context %}
+ {% endblock children %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
new file mode 100644
index 00000000..d5bd4220
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
@@ -0,0 +1,70 @@
+{%- if config.show_signature -%}
+ {% block logs scoped %}
+ {{ log.debug("Rendering signature") }}
+ {% endblock logs %}
+ {%- with -%}
+
+ {%- set ns = namespace(
+ has_pos_only=False,
+ render_pos_only_separator=True,
+ render_kw_only_separator=True,
+ annotation="",
+ equal="=",
+ ) -%}
+
+ (
+ {%- for parameter in function.parameters -%}
+ {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
+
+ {%- if parameter.kind.value == "positional-only" -%}
+ {%- set ns.has_pos_only = True -%}
+ {%- else -%}
+ {%- if ns.has_pos_only and ns.render_pos_only_separator -%}
+ {%- set ns.render_pos_only_separator = False %}/, {% endif -%}
+ {%- if parameter.kind.value == "keyword-only" -%}
+ {%- if ns.render_kw_only_separator -%}
+ {%- set ns.render_kw_only_separator = False %}*, {% endif -%}
+ {%- endif -%}
+ {%- endif -%}
+
+ {%- if config.show_signature_annotations and parameter.annotation is not none -%}
+ {%- set ns.equal = " = " -%}
+ {%- if config.separate_signature and config.signature_crossrefs -%}
+ {%- with expression = parameter.annotation -%}
+ {%- set ns.annotation -%}: {% include "expression"|get_template with context %}{%- endset -%}
+ {%- endwith -%}
+ {%- else -%}
+ {%- set ns.annotation = ": " + parameter.annotation|safe -%}
+ {%- endif -%}
+ {%- else -%}
+ {%- set ns.equal = "=" -%}
+ {%- set ns.annotation = "" -%}
+ {%- endif -%}
+
+ {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
+ {%- set default = ns.equal + parameter.default|safe -%}
+ {%- endif -%}
+
+ {%- if parameter.kind.value == "variadic positional" -%}
+ {%- set ns.render_kw_only_separator = False -%}
+ {%- endif -%}
+
+ {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%}
+ {{ parameter.name }}{{ ns.annotation }}{{ default }}
+ {%- if not loop.last %}, {% endif -%}
+
+ {%- endif -%}
+ {%- endfor -%}
+ )
+ {%- if config.show_signature_annotations
+ and function.annotation
+ and not (config.merge_init_into_class and function.name == "__init__" )
+ %} -> {% if config.separate_signature and config.signature_crossrefs -%}
+ {%- with expression = function.annotation %}{% include "expression"|get_template with context %}{%- endwith -%}
+ {%- else -%}
+ {{ function.annotation|safe }}
+ {%- endif -%}
+ {%- endif -%}
+
+ {%- endwith -%}
+{%- endif -%}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
new file mode 100644
index 00000000..2390659d
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
@@ -0,0 +1,2 @@
+{% block logs scoped %}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
new file mode 100644
index 00000000..2390659d
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
@@ -0,0 +1,2 @@
+{% block logs scoped %}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
new file mode 100644
index 00000000..2390659d
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
@@ -0,0 +1,2 @@
+{% block logs scoped %}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
new file mode 100644
index 00000000..2390659d
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
@@ -0,0 +1,2 @@
+{% block logs scoped %}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
new file mode 100644
index 00000000..2390659d
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
@@ -0,0 +1,2 @@
+{% block logs scoped %}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
new file mode 100644
index 00000000..c3586f6a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
@@ -0,0 +1,35 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Attributes:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
new file mode 100644
index 00000000..339a0cee
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
@@ -0,0 +1,35 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Other parameters:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
new file mode 100644
index 00000000..ad69e78a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
@@ -0,0 +1,40 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Parameters:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
new file mode 100644
index 00000000..ae7f38dc
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
@@ -0,0 +1,34 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Raises:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
new file mode 100644
index 00000000..a37db154
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
@@ -0,0 +1,37 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Receives:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
new file mode 100644
index 00000000..8f7dbd9b
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
@@ -0,0 +1,37 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Returns:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
new file mode 100644
index 00000000..8ae5eb17
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
@@ -0,0 +1,34 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Warns:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
new file mode 100644
index 00000000..44670856
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
@@ -0,0 +1,37 @@
+{% block logs scoped %}
+ {{ log.debug() }}
+{% endblock %}
+
+{% import "language"|get_template as lang with context %}
+
+
+
+
+
+
+
+
+ | {{ section.title or lang.t("Yields:") }} |
+
+
+ |
+
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
new file mode 100644
index 00000000..9c03b815
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
@@ -0,0 +1,12 @@
+{% block logs scoped %}
+{% endblock logs %}
+
+{% set lang_pth = "languages/" ~ locale | get_template %}
+{% if lang_pth is existing_template %}
+ {% import lang_pth as lang %}
+ {% import "languages/en"|get_template as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+{% else %}
+ {% import "languages/en"|get_template as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+{% endif %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html.jinja
new file mode 100644
index 00000000..5a771d30
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "ATTRIBUTE",
+ "Attributes:": "Attributes:",
+ "Classes:": "Classes:",
+ "CLASS": "CLASS",
+ "DEFAULT:": "DEFAULT:",
+ "Default": "Default",
+ "default:": "default:",
+ "DESCRIPTION": "DESCRIPTION",
+ "Description": "Description",
+ "Examples:": "Examples:",
+ "Functions:": "Functions:",
+ "FUNCTION": "FUNCTION",
+ "Methods:": "Methods:",
+ "METHOD": "METHOD",
+ "Modules:": "Modules:",
+ "MODULE": "MODULE",
+ "Name": "Name",
+ "Other Parameters:": "Other Parameters:",
+ "PARAMETER": "PARAMETER",
+ "Parameters:": "Parameters:",
+ "RAISES": "RAISES",
+ "Raises:" : "Raises:",
+ "RECEIVES": "RECEIVES",
+ "Receives:": "Receives:",
+ "required": "required",
+ "RETURNS": "RETURNS",
+ "Returns:": "Returns:",
+ "Source code in": "Source code in",
+ "TYPE:": "TYPE:",
+ "Type": "Type",
+ "WARNS": "WARNS",
+ "Warns:": "Warns:",
+ "YIELDS": "YIELDS",
+ "Yields:": "Yields:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html.jinja
new file mode 100644
index 00000000..748fd8b7
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "Classes:": "",
+ "CLASS": "",
+ "DEFAULT:": "デフォルト:",
+ "Default": "デフォルト",
+ "default:": "デフォルト:",
+ "DESCRIPTION": "デスクリプション",
+ "Description": "デスクリプション",
+ "Examples:": "例:",
+ "Functions:": "",
+ "FUNCTION": "",
+ "Methods:": "",
+ "METHOD": "",
+ "Modules:": "",
+ "MODULE": "",
+ "Name": "名前",
+ "Other Parameters:": "他の引数:",
+ "PARAMETER": "引数",
+ "Parameters:": "引数:",
+ "RAISES": "発生",
+ "Raises:" : "発生:",
+ "RECEIVES": "取得",
+ "Receives:": "取得:",
+ "required": "必須",
+ "RETURNS": "戻り値",
+ "Returns:": "戻り値:",
+ "Source code in": "ソースコード位置:",
+ "TYPE:": "タイプ:",
+ "Type": "タイプ",
+ "WARNS": "警告",
+ "Warns:": "警告:",
+ "YIELDS": "返す",
+ "Yields:": "返す:",
+}[key] }}{% endmacro %}
\ No newline at end of file
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html.jinja
new file mode 100644
index 00000000..772e33cd
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html.jinja
@@ -0,0 +1,39 @@
+
+{% block logs scoped %}
+{% endblock logs %}
+{% macro t(key) %}{{ {
+ "ATTRIBUTE": "属性",
+ "Attributes:": "属性:",
+ "Classes:": "",
+ "CLASS": "",
+ "DEFAULT:": "默认:",
+ "Default": "默认",
+ "default:": "默认:",
+ "DESCRIPTION": "描述",
+ "Description": "描述",
+ "Examples:": "示例:",
+ "Functions:": "",
+ "FUNCTION": "",
+ "Methods:": "",
+ "METHOD": "",
+ "Modules:": "",
+ "MODULE": "",
+ "Name": "名称",
+ "Other Parameters:": "其他参数:",
+ "PARAMETER": "参数",
+ "Parameters:": "参数:",
+ "RAISES": "引发",
+ "Raises:" : "引发:",
+ "Receives:": "接收:",
+ "RECEIVES": "接收",
+ "required": "必需",
+ "RETURNS": "返回",
+ "Returns:": "返回:",
+ "Source code in": "源代码位于:",
+ "TYPE:": "类型:",
+ "Type": "类型",
+ "Warns:": "警告:",
+ "WARNS": "警告",
+ "YIELDS": "产生",
+ "Yields:": "产生:",
+}[key] }}{% endmacro %}
\ No newline at end of file
From 7c14924c406d7b5f4f1c22d03019d4c566018d2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:54:37 +0200
Subject: [PATCH 043/243] refactor: Add `*.html.jinja` top-level (overridable)
templates, extending their base counterpart
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
.../python/templates/material/attribute.html.jinja | 1 +
.../python/templates/material/children.html.jinja | 1 +
.../python/templates/material/class.html.jinja | 1 +
.../python/templates/material/docstring.html.jinja | 1 +
.../python/templates/material/docstring/admonition.html.jinja | 1 +
.../python/templates/material/docstring/attributes.html.jinja | 1 +
.../python/templates/material/docstring/classes.html.jinja | 1 +
.../python/templates/material/docstring/examples.html.jinja | 1 +
.../python/templates/material/docstring/functions.html.jinja | 1 +
.../python/templates/material/docstring/modules.html.jinja | 1 +
.../templates/material/docstring/other_parameters.html.jinja | 1 +
.../python/templates/material/docstring/parameters.html.jinja | 1 +
.../python/templates/material/docstring/raises.html.jinja | 1 +
.../python/templates/material/docstring/receives.html.jinja | 1 +
.../python/templates/material/docstring/returns.html.jinja | 1 +
.../python/templates/material/docstring/warns.html.jinja | 1 +
.../python/templates/material/docstring/yields.html.jinja | 1 +
.../python/templates/material/expression.html.jinja | 1 +
.../python/templates/material/function.html.jinja | 1 +
.../python/templates/material/labels.html.jinja | 1 +
.../python/templates/material/language.html.jinja | 1 +
.../python/templates/material/languages/en.html.jinja | 1 +
.../python/templates/material/languages/ja.html.jinja | 1 +
.../python/templates/material/languages/zh.html.jinja | 1 +
.../python/templates/material/module.html.jinja | 1 +
.../python/templates/material/signature.html.jinja | 1 +
.../python/templates/material/summary.html.jinja | 1 +
.../python/templates/material/summary/attributes.html.jinja | 1 +
.../python/templates/material/summary/classes.html.jinja | 1 +
.../python/templates/material/summary/functions.html.jinja | 1 +
.../python/templates/material/summary/modules.html.jinja | 1 +
.../python/templates/readthedocs/docstring/attributes.html.jinja | 1 +
.../templates/readthedocs/docstring/other_parameters.html.jinja | 1 +
.../python/templates/readthedocs/docstring/parameters.html.jinja | 1 +
.../python/templates/readthedocs/docstring/raises.html.jinja | 1 +
.../python/templates/readthedocs/docstring/receives.html.jinja | 1 +
.../python/templates/readthedocs/docstring/returns.html.jinja | 1 +
.../python/templates/readthedocs/docstring/warns.html.jinja | 1 +
.../python/templates/readthedocs/docstring/yields.html.jinja | 1 +
.../python/templates/readthedocs/language.html.jinja | 1 +
.../python/templates/readthedocs/languages/en.html.jinja | 1 +
.../python/templates/readthedocs/languages/ja.html.jinja | 1 +
.../python/templates/readthedocs/languages/zh.html.jinja | 1 +
43 files changed, 43 insertions(+)
create mode 100644 src/mkdocstrings_handlers/python/templates/material/attribute.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/children.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/class.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/classes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/examples.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/functions.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/modules.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/raises.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/receives.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/returns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/warns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/docstring/yields.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/expression.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/function.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/labels.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/language.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/languages/en.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/languages/ja.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/languages/zh.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/module.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/signature.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/summary.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/summary/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/summary/classes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/summary/functions.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/material/summary/modules.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/language.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja
diff --git a/src/mkdocstrings_handlers/python/templates/material/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/attribute.html.jinja
new file mode 100644
index 00000000..a3c27503
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/attribute.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/attribute.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/children.html.jinja
new file mode 100644
index 00000000..2c2a73ab
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/children.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/children.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/class.html.jinja
new file mode 100644
index 00000000..5e7329df
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/class.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/class.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring.html.jinja
new file mode 100644
index 00000000..a7ccd66c
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html.jinja
new file mode 100644
index 00000000..e9da5e9a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/admonition.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html.jinja
new file mode 100644
index 00000000..4ac364b0
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html.jinja
new file mode 100644
index 00000000..035b3102
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html.jinja
new file mode 100644
index 00000000..34e9c4ba
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/examples.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html.jinja
new file mode 100644
index 00000000..f3eaed78
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html.jinja
new file mode 100644
index 00000000..8ea02a33
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html.jinja
new file mode 100644
index 00000000..7c50379b
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html.jinja
new file mode 100644
index 00000000..70c557fb
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html.jinja
new file mode 100644
index 00000000..f8c3cf03
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html.jinja
new file mode 100644
index 00000000..004ff00e
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html.jinja
new file mode 100644
index 00000000..979ce9ef
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html.jinja
new file mode 100644
index 00000000..bb06cc85
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html.jinja
new file mode 100644
index 00000000..717ef5d4
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/expression.html.jinja b/src/mkdocstrings_handlers/python/templates/material/expression.html.jinja
new file mode 100644
index 00000000..60c64d79
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/expression.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/expression.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/function.html.jinja b/src/mkdocstrings_handlers/python/templates/material/function.html.jinja
new file mode 100644
index 00000000..54bba061
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/function.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/function.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/labels.html.jinja b/src/mkdocstrings_handlers/python/templates/material/labels.html.jinja
new file mode 100644
index 00000000..51cb29d6
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/labels.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/labels.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/language.html.jinja b/src/mkdocstrings_handlers/python/templates/material/language.html.jinja
new file mode 100644
index 00000000..b905cff4
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/language.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/material/languages/en.html.jinja
new file mode 100644
index 00000000..931967c1
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/en.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html.jinja
new file mode 100644
index 00000000..17070edf
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html.jinja
new file mode 100644
index 00000000..e4ea3116
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/zh.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/module.html.jinja b/src/mkdocstrings_handlers/python/templates/material/module.html.jinja
new file mode 100644
index 00000000..9d8efea5
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/module.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/module.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/signature.html.jinja b/src/mkdocstrings_handlers/python/templates/material/signature.html.jinja
new file mode 100644
index 00000000..33b266c8
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/signature.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/signature.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary.html.jinja
new file mode 100644
index 00000000..59eddea0
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html.jinja
new file mode 100644
index 00000000..c69755c6
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html.jinja
new file mode 100644
index 00000000..825eb1bb
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html.jinja
new file mode 100644
index 00000000..fc609bda
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html.jinja
new file mode 100644
index 00000000..46db0023
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html.jinja
new file mode 100644
index 00000000..4ac364b0
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html.jinja
new file mode 100644
index 00000000..7c50379b
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html.jinja
new file mode 100644
index 00000000..70c557fb
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html.jinja
new file mode 100644
index 00000000..f8c3cf03
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html.jinja
new file mode 100644
index 00000000..004ff00e
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html.jinja
new file mode 100644
index 00000000..979ce9ef
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html.jinja
new file mode 100644
index 00000000..bb06cc85
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html.jinja
new file mode 100644
index 00000000..717ef5d4
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html.jinja
new file mode 100644
index 00000000..b905cff4
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html.jinja
new file mode 100644
index 00000000..931967c1
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja
new file mode 100644
index 00000000..17070edf
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja
new file mode 100644
index 00000000..e4ea3116
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/languages/zh.html.jinja" %}
From e6f1b9caf13754eca9dbb2f112727bef50876ed7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:57:59 +0200
Subject: [PATCH 044/243] refactor: Update `*.html` base templates to extend
their `*.html.jinja` counterpart, while overriding the `logs` block to issue
a logging message (info) stating that extending `*.html` templates is
deprecated
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
.../templates/material/_base/attribute.html | 91 ++--------
.../templates/material/_base/children.html | 165 ++----------------
.../templates/material/_base/class.html | 153 ++--------------
.../templates/material/_base/docstring.html | 45 ++---
.../material/_base/docstring/admonition.html | 16 +-
.../material/_base/docstring/attributes.html | 99 ++---------
.../material/_base/docstring/classes.html | 76 ++------
.../material/_base/docstring/examples.html | 21 ++-
.../material/_base/docstring/functions.html | 82 ++-------
.../material/_base/docstring/modules.html | 76 ++------
.../_base/docstring/other_parameters.html | 99 ++---------
.../material/_base/docstring/parameters.html | 122 ++-----------
.../material/_base/docstring/raises.html | 92 ++--------
.../material/_base/docstring/receives.html | 112 ++----------
.../material/_base/docstring/returns.html | 112 ++----------
.../material/_base/docstring/warns.html | 92 ++--------
.../material/_base/docstring/yields.html | 112 ++----------
.../templates/material/_base/expression.html | 65 ++-----
.../templates/material/_base/function.html | 109 ++----------
.../templates/material/_base/labels.html | 19 +-
.../templates/material/_base/language.html | 11 ++
.../material/_base/languages/en.html | 48 ++---
.../material/_base/languages/ja.html | 48 ++---
.../material/_base/languages/zh.html | 48 ++---
.../templates/material/_base/module.html | 85 ++-------
.../templates/material/_base/signature.html | 79 ++-------
.../templates/material/_base/summary.html | 11 ++
.../material/_base/summary/attributes.html | 11 ++
.../material/_base/summary/classes.html | 11 ++
.../material/_base/summary/functions.html | 11 ++
.../material/_base/summary/modules.html | 11 ++
.../_base/docstring/attributes.html | 11 ++
.../_base/docstring/other_parameters.html | 11 ++
.../_base/docstring/parameters.html | 11 ++
.../readthedocs/_base/docstring/raises.html | 11 ++
.../readthedocs/_base/docstring/receives.html | 11 ++
.../readthedocs/_base/docstring/returns.html | 11 ++
.../readthedocs/_base/docstring/warns.html | 11 ++
.../readthedocs/_base/docstring/yields.html | 11 ++
.../templates/readthedocs/_base/language.html | 11 ++
.../readthedocs/_base/languages/en.html | 11 ++
.../readthedocs/_base/languages/ja.html | 11 ++
.../readthedocs/_base/languages/zh.html | 11 ++
43 files changed, 460 insertions(+), 1804 deletions(-)
create mode 100644 src/mkdocstrings_handlers/python/templates/material/_base/language.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html
create mode 100644 src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
index 80a75fc9..7effc590 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
@@ -1,80 +1,11 @@
-{{ log.debug("Rendering " + attribute.path) }}
-
-
- {% with obj = attribute, html_id = attribute.path %}
-
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set attribute_name = attribute.path if show_full_path else attribute.name %}
-
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="data" if attribute.parent.kind.value == "module" else "attr",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
- ) %}
-
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ attribute_name }}
- {% else %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ attribute_name }}{% if attribute.annotation %}: {{ attribute.annotation }}{% endif %}
- {% if attribute.value %} = {{ attribute.value }}{% endif %}
- {% endfilter %}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = attribute.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
-
- {% endfilter %}
-
- {% block signature scoped %}
- {% if config.separate_signature %}
- {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ attribute.name }}
- {% endfilter %}
- {% endif %}
- {% endblock signature %}
-
- {% else %}
-
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="data" if attribute.parent.kind.value == "module" else "attr",
- id=html_id,
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
- hidden=True,
- ) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = attribute.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
- {% endblock contents %}
-
-
- {% endwith %}
-
+{% extends "_base/attribute.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/attribute.html' is deprecated, extend '_base/attribute.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html b/src/mkdocstrings_handlers/python/templates/material/_base/children.html
index cd9a8fac..15fada5a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html
@@ -1,154 +1,11 @@
-{% if obj.members %}
- {{ log.debug("Rendering children of " + obj.path) }}
-
-
-
- {% if root_members %}
- {% set members_list = config.members %}
- {% else %}
- {% set members_list = none %}
- {% endif %}
-
- {% if config.group_by_category %}
-
- {% with %}
-
- {% if config.show_category_heading %}
- {% set extra_level = 1 %}
- {% else %}
- {% set extra_level = 0 %}
- {% endif %}
-
- {% with attributes = obj.attributes|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
- {% if attributes %}
- {% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
- {% endif %}
- {% with heading_level = heading_level + extra_level %}
- {% for attribute in attributes|order_members(config.members_order, members_list) %}
- {% if members_list is not none or attribute.is_public(check_name=False) %}
- {% include attribute|get_template with context %}
- {% endif %}
- {% endfor %}
- {% endwith %}
- {% endif %}
- {% endwith %}
-
- {% with classes = obj.classes|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
- {% if classes %}
- {% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
- {% endif %}
- {% with heading_level = heading_level + extra_level %}
- {% for class in classes|order_members(config.members_order, members_list) %}
- {% if members_list is not none or class.is_public(check_name=False) %}
- {% include class|get_template with context %}
- {% endif %}
- {% endfor %}
- {% endwith %}
- {% endif %}
- {% endwith %}
-
- {% with functions = obj.functions|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
- {% if functions %}
- {% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
- {% endif %}
- {% with heading_level = heading_level + extra_level %}
- {% for function in functions|order_members(config.members_order, members_list) %}
- {% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %}
- {% if members_list is not none or function.is_public(check_name=False) %}
- {% include function|get_template with context %}
- {% endif %}
- {% endif %}
- {% endfor %}
- {% endwith %}
- {% endif %}
- {% endwith %}
-
- {% if config.show_submodules %}
- {% with modules = obj.modules|filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- ) %}
- {% if modules %}
- {% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
- {% endif %}
- {% with heading_level = heading_level + extra_level %}
- {% for module in modules|order_members(config.members_order.alphabetical, members_list) %}
- {% if members_list is not none or module.is_public(check_name=False) %}
- {% include module|get_template with context %}
- {% endif %}
- {% endfor %}
- {% endwith %}
- {% endif %}
- {% endwith %}
- {% endif %}
-
- {% endwith %}
-
- {% else %}
-
- {% for child in obj.all_members
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members(config.members_order, members_list)
- %}
-
- {% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
-
- {% if members_list is not none or child.is_public(check_name=False) %}
- {% if child.is_attribute %}
- {% with attribute = child %}
- {% include attribute|get_template with context %}
- {% endwith %}
-
- {% elif child.is_class %}
- {% with class = child %}
- {% include class|get_template with context %}
- {% endwith %}
-
- {% elif child.is_function %}
- {% with function = child %}
- {% include function|get_template with context %}
- {% endwith %}
-
- {% elif child.is_module and config.show_submodules %}
- {% with module = child %}
- {% include module|get_template with context %}
- {% endwith %}
-
- {% endif %}
- {% endif %}
-
- {% endif %}
-
- {% endfor %}
-
- {% endif %}
-
-
-
-{% endif %}
+{% extends "_base/children.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/children.html' is deprecated, extend '_base/children.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html b/src/mkdocstrings_handlers/python/templates/material/_base/class.html
index 2934c7c0..ac3e421e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html
@@ -1,142 +1,11 @@
-{{ log.debug("Rendering " + class.path) }}
-
-
- {% with obj = class, html_id = class.path %}
-
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set class_name = class.path if show_full_path else class.name %}
-
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="class",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
- ) %}
-
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ class_name }}
- {% elif config.merge_init_into_class and "__init__" in class.all_members %}
- {% with function = class.all_members["__init__"] %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ class_name }}{% include "signature.html" with context %}
- {% endfilter %}
- {% endwith %}
- {% else %}
- {{ class_name }}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = class.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
-
- {% endfilter %}
-
- {% block signature scoped %}
- {% if config.separate_signature and config.merge_init_into_class %}
- {% if "__init__" in class.all_members %}
- {% with function = class.all_members["__init__"] %}
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ class.name }}
- {% endfilter %}
- {% endwith %}
- {% endif %}
- {% endif %}
- {% endblock signature %}
-
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="class",
- id=html_id,
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
- hidden=True,
- ) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- {% block contents scoped %}
- {% block bases scoped %}
- {% if config.show_bases and class.bases %}
-
- Bases: {% for expression in class.bases -%}
- {% include "expression.html" with context %}{% if not loop.last %}, {% endif %}
- {% endfor -%}
-
- {% endif %}
- {% endblock bases %}
-
- {% block docstring scoped %}
- {% with docstring_sections = class.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% if config.merge_init_into_class %}
- {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
- {% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endif %}
- {% endif %}
- {% endblock docstring %}
-
- {% block source scoped %}
- {% if config.show_source %}
- {% if config.merge_init_into_class %}
- {% if "__init__" in class.all_members and class.all_members["__init__"].source %}
- {% with init = class.all_members["__init__"] %}
-
- Source code in
- {%- if init.relative_filepath.is_absolute() -%}
- {{ init.relative_package_filepath }}
- {%- else -%}
- {{ init.relative_filepath }}
- {%- endif -%}
-
- {{ init.source|highlight(language="python", linestart=init.lineno, linenums=True) }}
-
- {% endwith %}
- {% endif %}
- {% elif class.source %}
-
- Source code in
- {%- if class.relative_filepath.is_absolute() -%}
- {{ class.relative_package_filepath }}
- {%- else -%}
- {{ class.relative_filepath }}
- {%- endif -%}
-
- {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
-
- {% endif %}
- {% endif %}
- {% endblock source %}
-
- {% block children scoped %}
- {% set root = False %}
- {% set heading_level = heading_level + 1 %}
- {% include "children.html" with context %}
- {% endblock children %}
- {% endblock contents %}
-
-
- {% endwith %}
-
-
+{% extends "_base/class.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/class.html' is deprecated, extend '_base/class.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
index a80d5c76..5ef9da3e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
@@ -1,34 +1,11 @@
-{% if docstring_sections %}
- {{ log.debug("Rendering docstring") }}
- {% for section in docstring_sections %}
- {% if config.show_docstring_description and section.kind.value == "text" %}
- {{ section.value|convert_markdown(heading_level, html_id) }}
- {% elif config.show_docstring_attributes and section.kind.value == "attributes" %}
- {% include "docstring/attributes.html" with context %}
- {% elif config.show_docstring_functions and section.kind.value == "functions" %}
- {% include "docstring/functions.html" with context %}
- {% elif config.show_docstring_classes and section.kind.value == "classes" %}
- {% include "docstring/classes.html" with context %}
- {% elif config.show_docstring_modules and section.kind.value == "modules" %}
- {% include "docstring/modules.html" with context %}
- {% elif config.show_docstring_parameters and section.kind.value == "parameters" %}
- {% include "docstring/parameters.html" with context %}
- {% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %}
- {% include "docstring/other_parameters.html" with context %}
- {% elif config.show_docstring_raises and section.kind.value == "raises" %}
- {% include "docstring/raises.html" with context %}
- {% elif config.show_docstring_warns and section.kind.value == "warns" %}
- {% include "docstring/warns.html" with context %}
- {% elif config.show_docstring_yields and section.kind.value == "yields" %}
- {% include "docstring/yields.html" with context %}
- {% elif config.show_docstring_receives and section.kind.value == "receives" %}
- {% include "docstring/receives.html" with context %}
- {% elif config.show_docstring_returns and section.kind.value == "returns" %}
- {% include "docstring/returns.html" with context %}
- {% elif config.show_docstring_examples and section.kind.value == "examples" %}
- {% include "docstring/examples.html" with context %}
- {% elif config.show_docstring_description and section.kind.value == "admonition" %}
- {% include "docstring/admonition.html" with context %}
- {% endif %}
- {% endfor %}
-{% endif %}
+{% extends "_base/docstring.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring.html' is deprecated, extend '_base/docstring.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html
index 7d056df8..a8a75542 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html
@@ -1,5 +1,11 @@
-{{ log.debug("Rendering admonition") }}
-
- {{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True) }}
- {{ section.value.contents|convert_markdown(heading_level, html_id) }}
-
\ No newline at end of file
+{% extends "_base/docstring/admonition.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/admonition.html' is deprecated, extend '_base/docstring/admonition.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
index 99824653..cd4b05be 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
@@ -1,90 +1,11 @@
-{{ log.debug("Rendering attributes section") }}
+{% extends "_base/docstring/attributes.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for attribute in section.value %}
-
- {{ attribute.name }} |
-
- {% if attribute.annotation %}
- {% with expression = attribute.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Attributes:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for attribute in section.value %}
-
- {{ attribute.name }} |
-
-
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if attribute.annotation %}
-
- TYPE:
- {% with expression = attribute.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/attributes.html' is deprecated, extend '_base/docstring/attributes.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
index c0acac8a..78b47e2d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
@@ -1,67 +1,11 @@
-{{ log.debug("Rendering classes section") }}
+{% extends "_base/docstring/classes.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Classes:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for class in section.value %}
-
- {{ class.name }} |
-
-
- {{ class.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Classes:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("CLASS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for class in section.value %}
-
- {{ class.name }} |
-
-
- {{ class.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/classes.html' is deprecated, extend '_base/docstring/classes.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
index 5305efa9..37674811 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
@@ -1,12 +1,11 @@
-{{ log.debug("Rendering examples section") }}
+{% extends "_base/docstring/examples.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{{ section.title or lang.t("Examples:") }}
-{% for section_type, sub_section in section.value %}
- {% if section_type.value == "text" %}
- {{ sub_section|convert_markdown(heading_level, html_id) }}
- {% elif section_type.value == "examples" %}
- {{ sub_section|highlight(language="pycon", linenums=False) }}
- {% endif %}
-{% endfor %}
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/examples.html' is deprecated, extend '_base/docstring/examples.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
index 696826f0..a61c48fb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
@@ -1,73 +1,11 @@
-{{ log.debug("Rendering functions section") }}
+{% extends "_base/docstring/functions.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for function in section.value %}
- {% if not function.name == "__init__" or not config.merge_init_into_class %}
-
- {{ function.name }} |
-
-
- {{ function.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endif %}
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("METHOD") if obj.is_class else lang.t("FUNCTION")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for function in section.value %}
- {% if not function.name == "__init__" or not config.merge_init_into_class %}
-
- {{ function.name }} |
-
-
- {{ function.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endif %}
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/functions.html' is deprecated, extend '_base/docstring/functions.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
index d5ea77e6..d0b303b4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
@@ -1,67 +1,11 @@
-{{ log.debug("Rendering modules section") }}
+{% extends "_base/docstring/modules.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Modules:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for module in section.value %}
-
- {{ module.name }} |
-
-
- {{ module.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Modules:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("MODULE")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for module in section.value %}
-
- {{ module.name }} |
-
-
- {{ module.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/modules.html' is deprecated, extend '_base/docstring/modules.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
index 17d6d355..eae60aa7 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
@@ -1,90 +1,11 @@
-{{ log.debug("Rendering other parameters section") }}
+{% extends "_base/docstring/other_parameters.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Other Parameters:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if parameter.annotation %}
-
- {{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/other_parameters.html' is deprecated, extend '_base/docstring/other_parameters.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
index 7980096d..f5745464 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
@@ -1,113 +1,11 @@
-{{ log.debug("Rendering parameters section") }}
+{% extends "_base/docstring/parameters.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
-
-
-
- | {{ lang.t("Name") }} |
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
- {{ lang.t("Default") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
- {% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% if parameter.default %}
- {% with expression = parameter.default %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% else %}
- {{ lang.t("required") }}
- {% endif %}
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Parameters:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("PARAMETER")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for parameter in section.value %}
-
- {{ parameter.name }} |
-
-
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
-
-
- {% if parameter.annotation %}
-
- {{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- {% if parameter.default %}
-
- {{ lang.t("DEFAULT:") }}
- {% with expression = parameter.default %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/parameters.html' is deprecated, extend '_base/docstring/parameters.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
index 8240dc09..361b9732 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
@@ -1,83 +1,11 @@
-{{ log.debug("Rendering raises section") }}
+{% extends "_base/docstring/raises.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Raises:") }}
-
-
-
- | {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for raises in section.value %}
-
-
- {% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ raises.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ lang.t(section.title) or lang.t("Raises:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RAISES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for raises in section.value %}
-
-
-
- {% with expression = raises.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
-
-
- {{ raises.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/raises.html' is deprecated, extend '_base/docstring/raises.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
index 1eff98ae..e5a115c1 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
@@ -1,103 +1,11 @@
-{{ log.debug("Rendering receives section") }}
+{% extends "_base/docstring/receives.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Receives:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for receives in section.value %}
-
- {% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} | {% endif %}
-
- {% if receives.annotation %}
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ receives.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Receives:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RECEIVES")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for receives in section.value %}
-
-
- {% if receives.name %}
- {{ receives.name }}
- {% elif receives.annotation %}
-
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ receives.description|convert_markdown(heading_level, html_id) }}
-
- {% if receives.name and receives.annotation %}
-
-
- {{ lang.t("TYPE:") }}
- {% with expression = receives.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
-
- {% endif %}
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/receives.html' is deprecated, extend '_base/docstring/receives.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
index bf3bdb4b..0e7807ac 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
@@ -1,103 +1,11 @@
-{{ log.debug("Rendering returns section") }}
+{% extends "_base/docstring/returns.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Returns:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for returns in section.value %}
-
- {% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} | {% endif %}
-
- {% if returns.annotation %}
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ returns.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Returns:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("RETURNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION").upper() }} |
-
-
-
- {% for returns in section.value %}
-
-
- {% if returns.name %}
- {{ returns.name }}
- {% elif returns.annotation %}
-
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ returns.description|convert_markdown(heading_level, html_id) }}
-
- {% if returns.name and returns.annotation %}
-
-
- {{ lang.t("TYPE:") }}
- {% with expression = returns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
-
- {% endif %}
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/returns.html' is deprecated, extend '_base/docstring/returns.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
index f7883a7a..b7b937a9 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
@@ -1,83 +1,11 @@
-{{ log.debug("Rendering warns section") }}
+{% extends "_base/docstring/warns.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {{ section.title or lang.t("Warns:") }}
-
-
-
- | {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for warns in section.value %}
-
-
- {% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ warns.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Warns:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("WARNS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for warns in section.value %}
-
-
-
- {% with expression = warns.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- |
-
-
- {{ warns.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/warns.html' is deprecated, extend '_base/docstring/warns.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
index 2a4bb734..ecd6f513 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
@@ -1,103 +1,11 @@
-{{ log.debug("Rendering yields section") }}
+{% extends "_base/docstring/yields.html.jinja" %}
-{% import "language.html" as lang with context %}
-
-{% if config.docstring_section_style == "table" %}
- {% block table_style scoped %}
- {% set name_column = section.value|selectattr("name")|any %}
- {{ section.title or lang.t("Yields:") }}
-
-
-
- {% if name_column %}| {{ lang.t("Name") }} | {% endif %}
- {{ lang.t("Type") }} |
- {{ lang.t("Description") }} |
-
-
-
- {% for yields in section.value %}
-
- {% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} | {% endif %}
-
- {% if yields.annotation %}
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
- {% endif %}
- |
-
-
- {{ yields.description|convert_markdown(heading_level, html_id) }}
-
- |
-
- {% endfor %}
-
-
- {% endblock table_style %}
-{% elif config.docstring_section_style == "list" %}
- {% block list_style scoped %}
- {{ section.title or lang.t("Yields:") }}
-
- {% endblock list_style %}
-{% elif config.docstring_section_style == "spacy" %}
- {% block spacy_style scoped %}
-
-
-
- | {{ (section.title or lang.t("YIELDS")).rstrip(":").upper() }} |
- {{ lang.t("DESCRIPTION") }} |
-
-
-
- {% for yields in section.value %}
-
-
- {% if yields.name %}
- {{ yields.name }}
- {% elif yields.annotation %}
-
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
- {% endif %}
- |
-
-
- {{ yields.description|convert_markdown(heading_level, html_id) }}
-
- {% if yields.name and yields.annotation %}
-
-
- {{ lang.t("TYPE:") }}:
- {% with expression = yields.annotation %}
- {% include "expression.html" with context %}
- {% endwith %}
-
-
- {% endif %}
- |
-
- {% endfor %}
-
-
- {% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/yields.html' is deprecated, extend '_base/docstring/yields.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
index 00e1c761..556b3e2b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
@@ -1,56 +1,11 @@
-{%- macro crossref(name, annotation_path) -%}
- {%- with full = name.canonical_path -%}
- {%- if annotation_path == "brief" -%}
- {%- set annotation = name.canonical_name -%}
- {%- elif annotation_path == "source" -%}
- {%- set annotation = name.name -%}
- {%- elif annotation_path == "full" -%}
- {%- set annotation = full -%}
- {%- endif -%}
- {%- for title, path in annotation|split_path(full) -%}
- {%- if not signature or config.signature_crossrefs -%}
- {%- filter stash_crossref(length=title|length) -%}
- {{ title }}
- {%- endfilter -%}
- {%- else -%}
- {{ title }}
- {%- endif -%}
- {%- if not loop.last -%}.{%- endif -%}
- {%- endfor -%}
- {%- endwith -%}
-{%- endmacro -%}
+{% extends "_base/expression.html.jinja" %}
-{%- macro render(expression, annotations_path) -%}
- {%- if expression is string -%}
- {%- if signature -%}{{ expression|safe }}{%- else -%}{{ expression }}{%- endif -%}
- {%- elif expression.classname == "ExprName" -%}
- {{ crossref(expression, annotations_path) }}
- {%- elif config.unwrap_annotated and expression.classname == "ExprSubscript" and expression.canonical_path in ("typing.Annotated", "typing_extensions.Annotated") -%}
- {{ render(expression.slice.elements[0], annotations_path) }}
- {%- elif expression.classname == "ExprAttribute" -%}
- {%- if annotations_path == "brief" -%}
- {%- if expression.last.is_enum_value -%}
- {{ crossref(expression.last.parent, "brief") }}.value
- {%- else -%}
- {{ render(expression.last, "brief") }}
- {%- endif -%}
- {%- elif annotations_path == "full" -%}
- {{ render(expression.first, "full") }}
- {%- for element in expression -%}
- {%- if not loop.first -%}
- {{ render(element, "brief") }}
- {%- endif -%}
- {%- endfor -%}
- {%- else -%}
- {%- for element in expression -%}
- {{ render(element, annotations_path) }}
- {%- endfor -%}
- {%- endif -%}
- {%- else -%}
- {%- for element in expression -%}
- {{ render(element, annotations_path) }}
- {%- endfor -%}
- {%- endif -%}
-{%- endmacro -%}
-
-{{ render(expression, config.annotations_path) }}
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/expression.html' is deprecated, extend '_base/expression.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
index c4a20a12..07be5abb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
@@ -1,98 +1,11 @@
-{{ log.debug("Rendering " + function.path) }}
-
-{% import "language.html" as lang with context %}
-
-
- {% with obj = function, html_id = function.path %}
-
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set function_name = function.path if show_full_path else function.name %}
- {% set symbol_type = "method" if function.parent.is_class else "function" %}
-
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="function",
- id=html_id,
- class="doc doc-heading",
- toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
- ) %}
-
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ function_name }}
- {% else %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ function_name }}{% include "signature.html" with context %}
- {% endfilter %}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = function.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
-
- {% endfilter %}
-
- {% block signature scoped %}
- {% if config.separate_signature %}
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ function.name }}
- {% endfilter %}
- {% endif %}
- {% endblock signature %}
-
- {% else %}
-
- {% if config.show_root_toc_entry %}
- {% filter heading(
- heading_level,
- role="function",
- id=html_id,
- toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
- hidden=True,
- ) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = function.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
-
- {% block source scoped %}
- {% if config.show_source and function.source %}
-
- {{ lang.t("Source code in") }}
- {%- if function.relative_filepath.is_absolute() -%}
- {{ function.relative_package_filepath }}
- {%- else -%}
- {{ function.relative_filepath }}
- {%- endif -%}
-
- {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}
-
- {% endif %}
- {% endblock source %}
- {% endblock contents %}
-
-
- {% endwith %}
-
+{% extends "_base/function.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/function.html' is deprecated, extend '_base/function.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
index a35bffbb..784150c4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
@@ -1,8 +1,11 @@
-{% if config.show_labels and labels %}
- {{ log.debug("Rendering labels") }}
-
- {% for label in labels|sort %}
- {{ label }}
- {% endfor %}
-
-{% endif %}
+{% extends "_base/labels.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/labels.html' is deprecated, extend '_base/labels.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/language.html b/src/mkdocstrings_handlers/python/templates/material/_base/language.html
new file mode 100644
index 00000000..c97d0c31
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/language.html
@@ -0,0 +1,11 @@
+{% extends "_base/language.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/language.html' is deprecated, extend '_base/language.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
index 1f76e059..eab87415 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
@@ -1,37 +1,11 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "ATTRIBUTE",
- "Attributes:": "Attributes:",
- "Classes:": "Classes:",
- "CLASS": "CLASS",
- "DEFAULT:": "DEFAULT:",
- "Default": "Default",
- "default:": "default:",
- "DESCRIPTION": "DESCRIPTION",
- "Description": "Description",
- "Examples:": "Examples:",
- "Functions:": "Functions:",
- "FUNCTION": "FUNCTION",
- "Methods:": "Methods:",
- "METHOD": "METHOD",
- "Modules:": "Modules:",
- "MODULE": "MODULE",
- "Name": "Name",
- "Other Parameters:": "Other Parameters:",
- "PARAMETER": "PARAMETER",
- "Parameters:": "Parameters:",
- "RAISES": "RAISES",
- "Raises:" : "Raises:",
- "RECEIVES": "RECEIVES",
- "Receives:": "Receives:",
- "required": "required",
- "RETURNS": "RETURNS",
- "Returns:": "Returns:",
- "Source code in": "Source code in",
- "TYPE:": "TYPE:",
- "Type": "Type",
- "WARNS": "WARNS",
- "Warns:": "Warns:",
- "YIELDS": "YIELDS",
- "Yields:": "Yields:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/en.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/en.html' is deprecated, extend '_base/languages/en.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
index 456e1170..14319499 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
@@ -1,37 +1,11 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "属性",
- "Attributes:": "属性:",
- "Classes:": "",
- "CLASS": "",
- "DEFAULT:": "デフォルト:",
- "Default": "デフォルト",
- "default:": "デフォルト:",
- "DESCRIPTION": "デスクリプション",
- "Description": "デスクリプション",
- "Examples:": "例:",
- "Functions:": "",
- "FUNCTION": "",
- "Methods:": "",
- "METHOD": "",
- "Modules:": "",
- "MODULE": "",
- "Name": "名前",
- "Other Parameters:": "他の引数:",
- "PARAMETER": "引数",
- "Parameters:": "引数:",
- "RAISES": "発生",
- "Raises:" : "発生:",
- "RECEIVES": "取得",
- "Receives:": "取得:",
- "required": "必須",
- "RETURNS": "戻り値",
- "Returns:": "戻り値:",
- "Source code in": "ソースコード位置:",
- "TYPE:": "タイプ:",
- "Type": "タイプ",
- "WARNS": "警告",
- "Warns:": "警告:",
- "YIELDS": "返す",
- "Yields:": "返す:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/ja.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/ja.html' is deprecated, extend '_base/languages/ja.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
index 9c018f27..0b281195 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
@@ -1,37 +1,11 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "属性",
- "Attributes:": "属性:",
- "Classes:": "",
- "CLASS": "",
- "DEFAULT:": "默认:",
- "Default": "默认",
- "default:": "默认:",
- "DESCRIPTION": "描述",
- "Description": "描述",
- "Examples:": "示例:",
- "Functions:": "",
- "FUNCTION": "",
- "Methods:": "",
- "METHOD": "",
- "Modules:": "",
- "MODULE": "",
- "Name": "名称",
- "Other Parameters:": "其他参数:",
- "PARAMETER": "参数",
- "Parameters:": "参数:",
- "RAISES": "引发",
- "Raises:" : "引发:",
- "Receives:": "接收:",
- "RECEIVES": "接收",
- "required": "必需",
- "RETURNS": "返回",
- "Returns:": "返回:",
- "Source code in": "源代码位于:",
- "TYPE:": "类型:",
- "Type": "类型",
- "Warns:": "警告:",
- "WARNS": "警告",
- "YIELDS": "产生",
- "Yields:": "产生:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/zh.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/zh.html' is deprecated, extend '_base/languages/zh.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
index 5c3080c6..918ab6d0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
@@ -1,74 +1,11 @@
-{{ log.debug("Rendering " + module.path) }}
-
-
- {% with obj = module, html_id = module.path %}
-
- {% if root %}
- {% set show_full_path = config.show_root_full_path %}
- {% set root_members = True %}
- {% elif root_members %}
- {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
- {% set root_members = False %}
- {% else %}
- {% set show_full_path = config.show_object_full_path %}
- {% endif %}
-
- {% set module_name = module.path if show_full_path else module.name %}
-
- {% if not root or config.show_root_heading %}
- {% filter heading(
- heading_level,
- role="module",
- id=html_id,
- class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
- ) %}
-
- {% block heading scoped %}
- {% if config.show_symbol_type_heading %} {% endif %}
- {% if config.separate_signature %}
- {{ module_name }}
- {% else %}
- {{ module_name }}
- {% endif %}
- {% endblock heading %}
-
- {% block labels scoped %}
- {% with labels = module.labels %}
- {% include "labels.html" with context %}
- {% endwith %}
- {% endblock labels %}
-
- {% endfilter %}
-
- {% else %}
- {% if config.show_root_toc_entry %}
- {% filter heading(heading_level,
- role="module",
- id=html_id,
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + module.name,
- hidden=True,
- ) %}
- {% endfilter %}
- {% endif %}
- {% set heading_level = heading_level - 1 %}
- {% endif %}
-
-
- {% block contents scoped %}
- {% block docstring scoped %}
- {% with docstring_sections = module.docstring.parsed %}
- {% include "docstring.html" with context %}
- {% endwith %}
- {% endblock docstring %}
-
- {% block children scoped %}
- {% set root = False %}
- {% set heading_level = heading_level + 1 %}
- {% include "children.html" with context %}
- {% endblock children %}
- {% endblock contents %}
-
-
- {% endwith %}
-
+{% extends "_base/module.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/module.html' is deprecated, extend '_base/module.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
index 6d3d2973..623879db 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
@@ -1,68 +1,11 @@
-{%- if config.show_signature -%}
- {{ log.debug("Rendering signature") }}
- {%- with -%}
-
- {%- set ns = namespace(
- has_pos_only=False,
- render_pos_only_separator=True,
- render_kw_only_separator=True,
- annotation="",
- equal="=",
- ) -%}
-
- (
- {%- for parameter in function.parameters -%}
- {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
-
- {%- if parameter.kind.value == "positional-only" -%}
- {%- set ns.has_pos_only = True -%}
- {%- else -%}
- {%- if ns.has_pos_only and ns.render_pos_only_separator -%}
- {%- set ns.render_pos_only_separator = False %}/, {% endif -%}
- {%- if parameter.kind.value == "keyword-only" -%}
- {%- if ns.render_kw_only_separator -%}
- {%- set ns.render_kw_only_separator = False %}*, {% endif -%}
- {%- endif -%}
- {%- endif -%}
-
- {%- if config.show_signature_annotations and parameter.annotation is not none -%}
- {%- set ns.equal = " = " -%}
- {%- if config.separate_signature and config.signature_crossrefs -%}
- {%- with expression = parameter.annotation -%}
- {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%}
- {%- endwith -%}
- {%- else -%}
- {%- set ns.annotation = ": " + parameter.annotation|safe -%}
- {%- endif -%}
- {%- else -%}
- {%- set ns.equal = "=" -%}
- {%- set ns.annotation = "" -%}
- {%- endif -%}
-
- {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
- {%- set default = ns.equal + parameter.default|safe -%}
- {%- endif -%}
-
- {%- if parameter.kind.value == "variadic positional" -%}
- {%- set ns.render_kw_only_separator = False -%}
- {%- endif -%}
-
- {% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%}
- {{ parameter.name }}{{ ns.annotation }}{{ default }}
- {%- if not loop.last %}, {% endif -%}
-
- {%- endif -%}
- {%- endfor -%}
- )
- {%- if config.show_signature_annotations
- and function.annotation
- and not (config.merge_init_into_class and function.name == "__init__" )
- %} -> {% if config.separate_signature and config.signature_crossrefs -%}
- {%- with expression = function.annotation %}{% include "expression.html" with context %}{%- endwith -%}
- {%- else -%}
- {{ function.annotation|safe }}
- {%- endif -%}
- {%- endif -%}
-
- {%- endwith -%}
-{%- endif -%}
\ No newline at end of file
+{% extends "_base/signature.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/signature.html' is deprecated, extend '_base/signature.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
index e69de29b..aa33dc9c 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
@@ -0,0 +1,11 @@
+{% extends "_base/summary.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/summary.html' is deprecated, extend '_base/summary.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
index e69de29b..f2643791 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
@@ -0,0 +1,11 @@
+{% extends "_base/summary/attributes.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/summary/attributes.html' is deprecated, extend '_base/summary/attributes.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
index e69de29b..5c6275b4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
@@ -0,0 +1,11 @@
+{% extends "_base/summary/classes.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/summary/classes.html' is deprecated, extend '_base/summary/classes.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
index e69de29b..31887e0a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
@@ -0,0 +1,11 @@
+{% extends "_base/summary/functions.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/summary/functions.html' is deprecated, extend '_base/summary/functions.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
index e69de29b..31dcb5f0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
@@ -0,0 +1,11 @@
+{% extends "_base/summary/modules.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/summary/modules.html' is deprecated, extend '_base/summary/modules.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html
new file mode 100644
index 00000000..cd4b05be
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/attributes.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/attributes.html' is deprecated, extend '_base/docstring/attributes.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html
new file mode 100644
index 00000000..eae60aa7
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/other_parameters.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/other_parameters.html' is deprecated, extend '_base/docstring/other_parameters.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html
new file mode 100644
index 00000000..f5745464
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/parameters.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/parameters.html' is deprecated, extend '_base/docstring/parameters.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html
new file mode 100644
index 00000000..361b9732
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/raises.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/raises.html' is deprecated, extend '_base/docstring/raises.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html
new file mode 100644
index 00000000..e5a115c1
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/receives.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/receives.html' is deprecated, extend '_base/docstring/receives.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html
new file mode 100644
index 00000000..0e7807ac
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/returns.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/returns.html' is deprecated, extend '_base/docstring/returns.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html
new file mode 100644
index 00000000..b7b937a9
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/warns.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/warns.html' is deprecated, extend '_base/docstring/warns.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html
new file mode 100644
index 00000000..ecd6f513
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html
@@ -0,0 +1,11 @@
+{% extends "_base/docstring/yields.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/docstring/yields.html' is deprecated, extend '_base/docstring/yields.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html
new file mode 100644
index 00000000..c97d0c31
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html
@@ -0,0 +1,11 @@
+{% extends "_base/language.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/language.html' is deprecated, extend '_base/language.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html
new file mode 100644
index 00000000..eab87415
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html
@@ -0,0 +1,11 @@
+{% extends "_base/languages/en.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/en.html' is deprecated, extend '_base/languages/en.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html
new file mode 100644
index 00000000..14319499
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html
@@ -0,0 +1,11 @@
+{% extends "_base/languages/ja.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/ja.html' is deprecated, extend '_base/languages/ja.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html
new file mode 100644
index 00000000..0b281195
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html
@@ -0,0 +1,11 @@
+{% extends "_base/languages/zh.html.jinja" %}
+
+{% block logs scoped %}
+ {{ super() }}
+ {# TODO: Switch to a warning after some time. #}
+ {{ log.info(
+ "DeprecationWarning: Extending '_base/languages/zh.html' is deprecated, extend '_base/languages/zh.html.jinja' instead. " ~
+ "After some time, this message will be logged as a warning, causing strict builds to fail.",
+ once=True,
+ ) }}
+{% endblock logs %}
From a8c540e95693e8500da884c32ad159b3bbaaa7ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:59:31 +0200
Subject: [PATCH 045/243] refactor: Update `*.html` top-level templates to
extend the `*.html.jinja` base templates
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
.../python/templates/material/attribute.html | 2 +-
.../python/templates/material/children.html | 2 +-
.../python/templates/material/class.html | 2 +-
.../python/templates/material/docstring.html | 2 +-
.../material/docstring/admonition.html | 2 +-
.../material/docstring/attributes.html | 2 +-
.../templates/material/docstring/classes.html | 2 +-
.../material/docstring/examples.html | 2 +-
.../material/docstring/functions.html | 2 +-
.../templates/material/docstring/modules.html | 2 +-
.../material/docstring/other_parameters.html | 2 +-
.../material/docstring/parameters.html | 2 +-
.../templates/material/docstring/raises.html | 2 +-
.../material/docstring/receives.html | 2 +-
.../templates/material/docstring/returns.html | 2 +-
.../templates/material/docstring/warns.html | 2 +-
.../templates/material/docstring/yields.html | 2 +-
.../python/templates/material/expression.html | 2 +-
.../python/templates/material/function.html | 2 +-
.../python/templates/material/labels.html | 2 +-
.../python/templates/material/language.html | 11 +-----
.../templates/material/languages/en.html | 2 +-
.../templates/material/languages/ja.html | 2 +-
.../templates/material/languages/zh.html | 2 +-
.../python/templates/material/module.html | 2 +-
.../python/templates/material/signature.html | 2 +-
.../python/templates/material/summary.html | 2 +-
.../material/summary/attributes.html | 2 +-
.../templates/material/summary/classes.html | 2 +-
.../templates/material/summary/functions.html | 2 +-
.../templates/material/summary/modules.html | 2 +-
.../readthedocs/docstring/attributes.html | 34 +---------------
.../docstring/other_parameters.html | 34 +---------------
.../readthedocs/docstring/parameters.html | 39 +------------------
.../readthedocs/docstring/raises.html | 33 +---------------
.../readthedocs/docstring/receives.html | 36 +----------------
.../readthedocs/docstring/returns.html | 36 +----------------
.../readthedocs/docstring/warns.html | 33 +---------------
.../readthedocs/docstring/yields.html | 36 +----------------
.../templates/readthedocs/language.html | 11 +-----
.../templates/readthedocs/languages/en.html | 38 +-----------------
.../templates/readthedocs/languages/ja.html | 38 +-----------------
.../templates/readthedocs/languages/zh.html | 38 +-----------------
43 files changed, 43 insertions(+), 434 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/attribute.html b/src/mkdocstrings_handlers/python/templates/material/attribute.html
index 78050206..a3c27503 100644
--- a/src/mkdocstrings_handlers/python/templates/material/attribute.html
+++ b/src/mkdocstrings_handlers/python/templates/material/attribute.html
@@ -1 +1 @@
-{% extends "_base/attribute.html" %}
+{% extends "_base/attribute.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/children.html b/src/mkdocstrings_handlers/python/templates/material/children.html
index 5fcb7388..2c2a73ab 100644
--- a/src/mkdocstrings_handlers/python/templates/material/children.html
+++ b/src/mkdocstrings_handlers/python/templates/material/children.html
@@ -1 +1 @@
-{% extends "_base/children.html" %}
+{% extends "_base/children.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/class.html b/src/mkdocstrings_handlers/python/templates/material/class.html
index c1e411a9..5e7329df 100644
--- a/src/mkdocstrings_handlers/python/templates/material/class.html
+++ b/src/mkdocstrings_handlers/python/templates/material/class.html
@@ -1 +1 @@
-{% extends "_base/class.html" %}
+{% extends "_base/class.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring.html b/src/mkdocstrings_handlers/python/templates/material/docstring.html
index 9df79c58..a7ccd66c 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring.html
@@ -1 +1 @@
-{% extends "_base/docstring.html" %}
+{% extends "_base/docstring.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html b/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html
index da2e9546..e9da5e9a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html
@@ -1 +1 @@
-{% extends "_base/docstring/admonition.html" %}
+{% extends "_base/docstring/admonition.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html
index 60b5e73a..4ac364b0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html
@@ -1 +1 @@
-{% extends "_base/docstring/attributes.html" %}
+{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html
index f92bdb60..035b3102 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html
@@ -1 +1 @@
-{% extends "_base/docstring/classes.html" %}
+{% extends "_base/docstring/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html
index 96f28261..34e9c4ba 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html
@@ -1 +1 @@
-{% extends "_base/docstring/examples.html" %}
+{% extends "_base/docstring/examples.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html
index 4621cc92..f3eaed78 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html
@@ -1 +1 @@
-{% extends "_base/docstring/functions.html" %}
+{% extends "_base/docstring/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html
index 0d8ef4d5..8ea02a33 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html
@@ -1 +1 @@
-{% extends "_base/docstring/modules.html" %}
+{% extends "_base/docstring/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html
index 86c40256..7c50379b 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html
@@ -1 +1 @@
-{% extends "_base/docstring/other_parameters.html" %}
+{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html
index ca3ae309..70c557fb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html
@@ -1 +1 @@
-{% extends "_base/docstring/parameters.html" %}
+{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html
index 0c789823..f8c3cf03 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html
@@ -1 +1 @@
-{% extends "_base/docstring/raises.html" %}
+{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html
index 8cf03922..004ff00e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html
@@ -1 +1 @@
-{% extends "_base/docstring/receives.html" %}
+{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html
index 19d92dda..979ce9ef 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html
@@ -1 +1 @@
-{% extends "_base/docstring/returns.html" %}
+{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html
index 2bef95fb..bb06cc85 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html
@@ -1 +1 @@
-{% extends "_base/docstring/warns.html" %}
+{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html
index 45e6cd6a..717ef5d4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html
@@ -1 +1 @@
-{% extends "_base/docstring/yields.html" %}
+{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/expression.html b/src/mkdocstrings_handlers/python/templates/material/expression.html
index 23c3515f..60c64d79 100644
--- a/src/mkdocstrings_handlers/python/templates/material/expression.html
+++ b/src/mkdocstrings_handlers/python/templates/material/expression.html
@@ -1 +1 @@
-{% extends "_base/expression.html" %}
+{% extends "_base/expression.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/function.html b/src/mkdocstrings_handlers/python/templates/material/function.html
index c44f96a8..54bba061 100644
--- a/src/mkdocstrings_handlers/python/templates/material/function.html
+++ b/src/mkdocstrings_handlers/python/templates/material/function.html
@@ -1 +1 @@
-{% extends "_base/function.html" %}
+{% extends "_base/function.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/labels.html b/src/mkdocstrings_handlers/python/templates/material/labels.html
index d835d7fb..51cb29d6 100644
--- a/src/mkdocstrings_handlers/python/templates/material/labels.html
+++ b/src/mkdocstrings_handlers/python/templates/material/labels.html
@@ -1 +1 @@
-{% extends "_base/labels.html" %}
+{% extends "_base/labels.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/language.html b/src/mkdocstrings_handlers/python/templates/material/language.html
index 26647ff3..b905cff4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/language.html
+++ b/src/mkdocstrings_handlers/python/templates/material/language.html
@@ -1,10 +1 @@
-
-{% set lang_pth = "languages/" ~ locale ~ ".html" %}
-{% if lang_pth is existing_template %}
- {% import lang_pth as lang %}
- {% import "languages/en.html" as fallback %}
- {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
-{% else %}
- {% import "languages/en.html" as lang %}
- {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
-{% endif %}
+{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/languages/en.html
index eab0a3f3..931967c1 100644
--- a/src/mkdocstrings_handlers/python/templates/material/languages/en.html
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/en.html
@@ -1 +1 @@
-{% extends "_base/languages/en.html" %}
\ No newline at end of file
+{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
index 0463322d..17070edf 100644
--- a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
@@ -1 +1 @@
-{% extends "_base/languages/ja.html" %}
\ No newline at end of file
+{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
index 90aeae6f..e4ea3116 100644
--- a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
+++ b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
@@ -1 +1 @@
-{% extends "_base/languages/zh.html" %}
\ No newline at end of file
+{% extends "_base/languages/zh.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/module.html b/src/mkdocstrings_handlers/python/templates/material/module.html
index ea9a2fad..9d8efea5 100644
--- a/src/mkdocstrings_handlers/python/templates/material/module.html
+++ b/src/mkdocstrings_handlers/python/templates/material/module.html
@@ -1 +1 @@
-{% extends "_base/module.html" %}
+{% extends "_base/module.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/signature.html b/src/mkdocstrings_handlers/python/templates/material/signature.html
index 4b756b9c..33b266c8 100644
--- a/src/mkdocstrings_handlers/python/templates/material/signature.html
+++ b/src/mkdocstrings_handlers/python/templates/material/signature.html
@@ -1 +1 @@
-{% extends "_base/signature.html" %}
+{% extends "_base/signature.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary.html b/src/mkdocstrings_handlers/python/templates/material/summary.html
index 6fccfa90..59eddea0 100644
--- a/src/mkdocstrings_handlers/python/templates/material/summary.html
+++ b/src/mkdocstrings_handlers/python/templates/material/summary.html
@@ -1 +1 @@
-{% extends "_base/summary.html" %}
+{% extends "_base/summary.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
index e088b5fc..c69755c6 100644
--- a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
@@ -1 +1 @@
-{% extends "_base/summary/attributes.html" %}
+{% extends "_base/summary/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
index ab845ed5..825eb1bb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
@@ -1 +1 @@
-{% extends "_base/summary/classes.html" %}
+{% extends "_base/summary/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
index d5c6231b..fc609bda 100644
--- a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
@@ -1 +1 @@
-{% extends "_base/summary/functions.html" %}
+{% extends "_base/summary/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
index 4765400f..46db0023 100644
--- a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
@@ -1 +1 @@
-{% extends "_base/summary/modules.html" %}
+{% extends "_base/summary/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
index 8411dda6..4ac364b0 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
@@ -1,33 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Attributes:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
index 44963a5a..7c50379b 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
@@ -1,33 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Other parameters:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
index e062b835..70c557fb 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
@@ -1,38 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Parameters:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
index f82437dd..f8c3cf03 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
@@ -1,32 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Raises:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
index 2ab1c2fd..004ff00e 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
@@ -1,35 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Receives:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
index 355eedcc..979ce9ef 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
@@ -1,35 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Returns:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
index 35aff0b1..bb06cc85 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
@@ -1,32 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Warns:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
index 4d639a75..717ef5d4 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
@@ -1,35 +1 @@
-{{ log.debug() }}
-
-{% import "language.html" as lang with context %}
-
-
-
-
-
-
-
-
- | {{ section.title or lang.t("Yields:") }} |
-
-
- |
-
-
-
+{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
index 26647ff3..b905cff4 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
@@ -1,10 +1 @@
-
-{% set lang_pth = "languages/" ~ locale ~ ".html" %}
-{% if lang_pth is existing_template %}
- {% import lang_pth as lang %}
- {% import "languages/en.html" as fallback %}
- {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
-{% else %}
- {% import "languages/en.html" as lang %}
- {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
-{% endif %}
+{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
index 1f76e059..931967c1 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
@@ -1,37 +1 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "ATTRIBUTE",
- "Attributes:": "Attributes:",
- "Classes:": "Classes:",
- "CLASS": "CLASS",
- "DEFAULT:": "DEFAULT:",
- "Default": "Default",
- "default:": "default:",
- "DESCRIPTION": "DESCRIPTION",
- "Description": "Description",
- "Examples:": "Examples:",
- "Functions:": "Functions:",
- "FUNCTION": "FUNCTION",
- "Methods:": "Methods:",
- "METHOD": "METHOD",
- "Modules:": "Modules:",
- "MODULE": "MODULE",
- "Name": "Name",
- "Other Parameters:": "Other Parameters:",
- "PARAMETER": "PARAMETER",
- "Parameters:": "Parameters:",
- "RAISES": "RAISES",
- "Raises:" : "Raises:",
- "RECEIVES": "RECEIVES",
- "Receives:": "Receives:",
- "required": "required",
- "RETURNS": "RETURNS",
- "Returns:": "Returns:",
- "Source code in": "Source code in",
- "TYPE:": "TYPE:",
- "Type": "Type",
- "WARNS": "WARNS",
- "Warns:": "Warns:",
- "YIELDS": "YIELDS",
- "Yields:": "Yields:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
index 456e1170..17070edf 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
@@ -1,37 +1 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "属性",
- "Attributes:": "属性:",
- "Classes:": "",
- "CLASS": "",
- "DEFAULT:": "デフォルト:",
- "Default": "デフォルト",
- "default:": "デフォルト:",
- "DESCRIPTION": "デスクリプション",
- "Description": "デスクリプション",
- "Examples:": "例:",
- "Functions:": "",
- "FUNCTION": "",
- "Methods:": "",
- "METHOD": "",
- "Modules:": "",
- "MODULE": "",
- "Name": "名前",
- "Other Parameters:": "他の引数:",
- "PARAMETER": "引数",
- "Parameters:": "引数:",
- "RAISES": "発生",
- "Raises:" : "発生:",
- "RECEIVES": "取得",
- "Receives:": "取得:",
- "required": "必須",
- "RETURNS": "戻り値",
- "Returns:": "戻り値:",
- "Source code in": "ソースコード位置:",
- "TYPE:": "タイプ:",
- "Type": "タイプ",
- "WARNS": "警告",
- "Warns:": "警告:",
- "YIELDS": "返す",
- "Yields:": "返す:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
index 9c018f27..e4ea3116 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
@@ -1,37 +1 @@
-
-{% macro t(key) %}{{ {
- "ATTRIBUTE": "属性",
- "Attributes:": "属性:",
- "Classes:": "",
- "CLASS": "",
- "DEFAULT:": "默认:",
- "Default": "默认",
- "default:": "默认:",
- "DESCRIPTION": "描述",
- "Description": "描述",
- "Examples:": "示例:",
- "Functions:": "",
- "FUNCTION": "",
- "Methods:": "",
- "METHOD": "",
- "Modules:": "",
- "MODULE": "",
- "Name": "名称",
- "Other Parameters:": "其他参数:",
- "PARAMETER": "参数",
- "Parameters:": "参数:",
- "RAISES": "引发",
- "Raises:" : "引发:",
- "Receives:": "接收:",
- "RECEIVES": "接收",
- "required": "必需",
- "RETURNS": "返回",
- "Returns:": "返回:",
- "Source code in": "源代码位于:",
- "TYPE:": "类型:",
- "Type": "类型",
- "Warns:": "警告:",
- "WARNS": "警告",
- "YIELDS": "产生",
- "Yields:": "产生:",
-}[key] }}{% endmacro %}
\ No newline at end of file
+{% extends "_base/languages/zh.html.jinja" %}
From 929cfb5a8fd68f28960f9e6de43b1b7a7203c835 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 14:59:47 +0200
Subject: [PATCH 046/243] tests: Use `*.html.jinja` template in tests
Issue-151: https://github.com/mkdocstrings/python/issues/151
---
tests/test_handler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_handler.py b/tests/test_handler.py
index e1d92c18..9f833d12 100644
--- a/tests/test_handler.py
+++ b/tests/test_handler.py
@@ -62,7 +62,7 @@ def test_render_docstring_examples_section(handler: PythonHandler) -> None:
(DocstringSectionKind.examples, ">>> print('Hello')\nHello"),
],
)
- template = handler.env.get_template("docstring/examples.html")
+ template = handler.env.get_template("docstring/examples.html.jinja")
rendered = template.render(section=section, locale="en")
template.render(section=section, locale="not_existing")
assert "This is an example. " in rendered
From ad09a2db7e7af6c3aec651a6545384645d45af1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 17:16:05 +0200
Subject: [PATCH 047/243] chore: Comment code in handler init method
---
src/mkdocstrings_handlers/python/handler.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index b075f3a7..6ef4281a 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -223,18 +223,28 @@ def __init__(
self._config_file_path = config_file_path
self._load_external_modules = load_external_modules
paths = paths or []
+
+ # Expand paths with glob patterns.
glob_base_dir = os.path.dirname(os.path.abspath(config_file_path)) if config_file_path else "."
with chdir(glob_base_dir):
resolved_globs = [glob.glob(path) for path in paths]
paths = [path for glob_list in resolved_globs for path in glob_list]
+
+ # By default, add the directory of the config file to the search paths.
if not paths and config_file_path:
paths.append(os.path.dirname(config_file_path))
- search_paths = [path for path in sys.path if path] # eliminate empty path
+
+ # Initialize search paths from `sys.path`, eliminating empty paths.
+ search_paths = [path for path in sys.path if path]
+
for path in reversed(paths):
+ # If it's not absolute, make path relative to the config file path, then make it absolute.
if not os.path.isabs(path) and config_file_path:
path = os.path.abspath(os.path.join(os.path.dirname(config_file_path), path)) # noqa: PLW2901
+ # Don't add duplicates.
if path not in search_paths:
search_paths.insert(0, path)
+
self._paths = search_paths
self._modules_collection: ModulesCollection = ModulesCollection()
self._lines_collection: LinesCollection = LinesCollection()
From a71ab12c8e52efe76e5c0a5e54065926a47cc0d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 17:16:24 +0200
Subject: [PATCH 048/243] refactor: Set handler's name
---
src/mkdocstrings_handlers/python/handler.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 6ef4281a..1e98b76f 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -53,6 +53,8 @@ def chdir(path: str) -> Iterator[None]: # noqa: D103
class PythonHandler(BaseHandler):
"""The Python handler class."""
+ name = "python"
+ """The handler's name."""
domain: str = "py" # to match Sphinx's default domain
"""The cross-documentation domain/language for this handler."""
enable_inventory: bool = True
From a5f2723337f00c269d808d552f5c496842ce2eb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 17:16:41 +0200
Subject: [PATCH 049/243] docs: Document handler's `update_env` method
---
src/mkdocstrings_handlers/python/handler.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py
index 1e98b76f..a473f92a 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/handler.py
@@ -398,7 +398,13 @@ def render(self, data: CollectorItem, config: Mapping[str, Any]) -> str: # noqa
},
)
- def update_env(self, md: Markdown, config: dict) -> None: # noqa: D102 (ignore missing docstring)
+ def update_env(self, md: Markdown, config: dict) -> None:
+ """Update the Jinja environment with custom filters and tests.
+
+ Parameters:
+ md: The Markdown instance.
+ config: The configuration dictionary.
+ """
super().update_env(md, config)
self.env.trim_blocks = True
self.env.lstrip_blocks = True
From cfdccd3c43bd5ebda1358279f77af59ab6132eb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 17:17:06 +0200
Subject: [PATCH 050/243] docs: Load Python-Markdown objects inventory
---
mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/mkdocs.yml b/mkdocs.yml
index 9a739787..1d253150 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -149,6 +149,7 @@ plugins:
- https://docs.python.org/3/objects.inv
- https://mkdocstrings.github.io/objects.inv
- https://mkdocstrings.github.io/griffe/objects.inv
+ - https://python-markdown.github.io/objects.inv
options:
docstring_options:
ignore_init_summary: true
From e7f997b0452c9b4d5fe04df32f1319f8038d586b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Sun, 28 Apr 2024 17:17:18 +0200
Subject: [PATCH 051/243] docs: Enable parameter headings
---
mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/mkdocs.yml b/mkdocs.yml
index 1d253150..631fbab9 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -158,6 +158,7 @@ plugins:
heading_level: 1
inherited_members: true
merge_init_into_class: true
+ parameter_headings: true
preload_modules: [mkdocstrings]
separate_signature: true
show_root_heading: true
From 583b8fefd987ccaa37a016121427e1141827ff71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?=
Date: Mon, 29 Apr 2024 12:00:49 +0200
Subject: [PATCH 052/243] docs: Document Jinja templates
Issue-149: https://github.com/mkdocstrings/python/issues/149
PR-156: https://github.com/mkdocstrings/python/pull/156
---
.../material/_base/attribute.html.jinja | 38 ++++++++++++++
.../material/_base/children.html.jinja | 16 ++++++
.../templates/material/_base/class.html.jinja | 50 ++++++++++++++++++-
.../material/_base/docstring.html.jinja | 17 +++++++
.../_base/docstring/admonition.html.jinja | 15 +++++-
.../_base/docstring/attributes.html.jinja | 17 +++++++
.../_base/docstring/classes.html.jinja | 17 +++++++
.../_base/docstring/examples.html.jinja | 14 ++++++
.../_base/docstring/functions.html.jinja | 17 +++++++
.../_base/docstring/modules.html.jinja | 17 +++++++
.../docstring/other_parameters.html.jinja | 17 +++++++
.../_base/docstring/parameters.html.jinja | 17 +++++++
.../_base/docstring/raises.html.jinja | 17 +++++++
.../_base/docstring/receives.html.jinja | 17 +++++++
.../_base/docstring/returns.html.jinja | 17 +++++++
.../material/_base/docstring/warns.html.jinja | 17 +++++++
.../_base/docstring/yields.html.jinja | 17 +++++++
.../material/_base/expression.html.jinja | 30 +++++++++++
.../material/_base/function.html.jinja | 44 ++++++++++++++++
.../material/_base/labels.html.jinja | 15 ++++++
.../material/_base/language.html.jinja | 8 ++-
.../material/_base/languages/en.html.jinja | 10 +++-
.../material/_base/languages/ja.html.jinja | 10 +++-
.../material/_base/languages/zh.html.jinja | 10 +++-
.../material/_base/module.html.jinja | 37 ++++++++++++++
.../material/_base/signature.html.jinja | 26 +++++++++-
.../material/_base/summary.html.jinja | 6 +++
.../_base/summary/attributes.html.jinja | 6 +++
.../material/_base/summary/classes.html.jinja | 6 +++
.../_base/summary/functions.html.jinja | 6 +++
.../material/_base/summary/modules.html.jinja | 6 +++
.../_base/docstring/attributes.html.jinja | 14 ++++++
.../docstring/other_parameters.html.jinja | 14 ++++++
.../_base/docstring/parameters.html.jinja | 14 ++++++
.../_base/docstring/raises.html.jinja | 14 ++++++
.../_base/docstring/receives.html.jinja | 14 ++++++
.../_base/docstring/returns.html.jinja | 14 ++++++
.../_base/docstring/warns.html.jinja | 14 ++++++
.../_base/docstring/yields.html.jinja | 14 ++++++
.../readthedocs/_base/language.html.jinja | 10 +++-
40 files changed, 666 insertions(+), 13 deletions(-)
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
index fd537034..11bc4e77 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
@@ -1,4 +1,20 @@
+{#- Template for Python attributes.
+
+This template renders a Python attribute (or variable).
+This can be a module attribute or a class attribute.
+
+Context:
+ attribute (griffe.dataclasses.Attribute): The attribute to render.
+ root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
+ heading_level (int): The HTML heading level to use.
+ config (dict): The configuration options.
+-#}
+
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering " + attribute.path) }}
{% endblock logs %}
@@ -27,6 +43,10 @@
) %}
{% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the attribute.
+ -#}
{% if config.show_symbol_type_heading %}{% endif %}
{% if config.separate_signature %}
{{ attribute_name }}
@@ -39,6 +59,10 @@
{% endblock heading %}
{% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the attribute.
+ -#}
{% with labels = attribute.labels %}
{% include "labels"|get_template with context %}
{% endwith %}
@@ -47,6 +71,10 @@
{% endfilter %}
{% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the attribute.
+ -#}
{% if config.separate_signature %}
{% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ attribute.name }}
@@ -70,7 +98,17 @@
{% block contents scoped %}
+ {#- Contents block.
+
+ This block renders the contents of the attribute.
+ It contains other blocks that users can override.
+ Overriding the contents block allows to rearrange the order of the blocks.
+ -#}
{% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the attribute.
+ -#}
{% with docstring_sections = attribute.docstring.parsed %}
{% include "docstring"|get_template with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
index b63b9a6a..b0ec4007 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
@@ -1,5 +1,21 @@
+{#- Template for members (children) of an object.
+
+This template iterates on members of a given object and renders them.
+It can group members by category (attributes, classes, functions, modules) or render them in a flat list.
+
+Context:
+ obj (griffe.dataclasses.Object): The object to render.
+ config (dict): The configuration options.
+ root_members (bool): Whether the object is the root object.
+ heading_level (int): The HTML heading level to use.
+-#}
+
{% if obj.members %}
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering children of " + obj.path) }}
{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
index 2bfa2bf0..bb32a91c 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
@@ -1,4 +1,19 @@
+{#- Template for Python classes.
+
+This template renders a Python class.
+
+Context:
+ class (griffe.dataclasses.Class): The class to render.
+ root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
+ heading_level (int): The HTML heading level to use.
+ config (dict): The configuration options.
+-#}
+
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering " + class.path) }}
{% endblock logs %}
@@ -27,6 +42,10 @@
) %}
{% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the class.
+ -#}
{% if config.show_symbol_type_heading %} {% endif %}
{% if config.separate_signature %}
{{ class_name }}
@@ -42,6 +61,10 @@
{% endblock heading %}
{% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the class.
+ -#}
{% with labels = class.labels %}
{% include "labels"|get_template with context %}
{% endwith %}
@@ -50,6 +73,10 @@
{% endfilter %}
{% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the class.
+ -#}
{% if config.separate_signature and config.merge_init_into_class %}
{% if "__init__" in class.all_members %}
{% with function = class.all_members["__init__"] %}
@@ -76,7 +103,17 @@
{% block contents scoped %}
+ {#- Contents block.
+
+ This block renders the contents of the class.
+ It contains other blocks that users can override.
+ Overriding the contents block allows to rearrange the order of the blocks.
+ -#}
{% block bases scoped %}
+ {#- Class bases block.
+
+ This block renders the bases for the class.
+ -#}
{% if config.show_bases and class.bases %}
Bases: {% for expression in class.bases -%}
@@ -87,6 +124,10 @@
{% endblock bases %}
{% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the class.
+ -#}
{% with docstring_sections = class.docstring.parsed %}
{% include "docstring"|get_template with context %}
{% endwith %}
@@ -100,6 +141,10 @@
{% endblock docstring %}
{% block source scoped %}
+ {#- Source block.
+
+ This block renders the source code for the class.
+ -#}
{% if config.show_source %}
{% if config.merge_init_into_class %}
{% if "__init__" in class.all_members and class.all_members["__init__"].source %}
@@ -132,6 +177,10 @@
{% endblock source %}
{% block children scoped %}
+ {#- Children block.
+
+ This block renders the children (members) of the class.
+ -#}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "children"|get_template with context %}
@@ -140,5 +189,4 @@
{% endwith %}
-
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
index 8477dc0a..f5095eb4 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
@@ -1,5 +1,22 @@
+{#- Template for docstrings.
+
+This template renders Python docstrings.
+Griffe parses docstrings into a list of sections, each with a `kind` and a `value`.
+This template can then iterate on these sections and render them according to the configuration.
+
+Context:
+ docstring_sections (list[griffe.docstrings.dataclasses.DocstringSection]): The list of docstring sections.
+ config (dict): The configuration dictionary.
+ heading_level (int): The heading level to use for Markdown conversion.
+ html_id (str): The HTML ID to use for Markdown conversion.
+-#}
+
{% if docstring_sections %}
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering docstring") }}
{% endblock logs %}
{% for section in docstring_sections %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
index b5053342..e3400280 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja
@@ -1,7 +1,20 @@
+{#- Template for admonitions in docstrings.
+
+This template renders admonitions using the `details` HTML element.
+
+Context:
+ section (griffe.docstrings.dataclasses.DocstringSectionAdmonition): The section to render.
+-#}
+
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering admonition") }}
{% endblock logs %}
+
{{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True) }}
{{ section.value.contents|convert_markdown(heading_level, html_id) }}
-
\ No newline at end of file
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
index d1bb3bb0..e6c03dee 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja
@@ -1,11 +1,26 @@
+{#- Template for "Attributes" sections in docstrings.
+
+This template renders a list of documented attributes in the format
+specified with the [`docstring_section_style`][] configuration option.
+
+Context:
+ section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render.
+-#}
+
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering attributes section") }}
{% endblock logs %}
{% import "language"|get_template as lang with context %}
+{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
+ {#- Block for the `table` section style. -#}
{{ section.title or lang.t("Attributes:") }}
@@ -38,6 +53,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
+ {#- Block for the `list` section style. -#}
{{ section.title or lang.t("Attributes:") }}
{% for attribute in section.value %}
@@ -58,6 +74,7 @@
{% endblock list_style %}
{% elif config.docstring_section_style == "spacy" %}
{% block spacy_style scoped %}
+ {#- Block for the `spacy` section style. -#}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
index 60ec7e54..1aee5fd2 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja
@@ -1,11 +1,26 @@
+{#- Template for "Classes" sections in docstrings.
+
+This template renders a list of documented classes in the format
+specified with the [`docstring_section_style`][] configuration option.
+
+Context:
+ section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render.
+-#}
+
{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
{{ log.debug("Rendering classes section") }}
{% endblock logs %}
{% import "language"|get_template as lang with context %}
+{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
{% block table_style scoped %}
+ {#- Block for the `table` section style. -#}
{{ section.title or lang.t("Classes:") }}
@@ -30,6 +45,7 @@
{% endblock table_style %}
{% elif config.docstring_section_style == "list" %}
{% block list_style scoped %}
+ {#- Block for the `list` section style. -#}
| | | | | | | | | | | | | | | | | | | | | | | | | | | | |