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] 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:") }} -
    - {% 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 %} -
-
+{% 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:") }} -
    - {% 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 %} -
-
+{% 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:") }} -
    - {% for parameter in section.value %} -
  • - {{ parameter.name }} - {% if parameter.annotation %} - {% with expression = parameter.annotation %} - ({% include "expression.html" with context %} - {%- if parameter.default %}, {{ lang.t("default:") }} - {% with expression = parameter.default %} - {% include "expression.html" with context %} - {% endwith %} - {% endif %}) - {% endwith %} - {% endif %} - – -
    - {{ parameter.description|convert_markdown(heading_level, html_id) }} -
    -
  • - {% endfor %} -
-
+{% 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:") }} -
    - {% 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 %} -
-
+{% 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:") }} -
    - {% for receives in section.value %} -
  • - {% if receives.name %}{{ receives.name }}{% endif %} - {% if receives.annotation %} - {% with expression = receives.annotation %} - {% if receives.name %}({% endif %} - {% include "expression.html" with context %} - {% if receives.name %}){% endif %} - {% endwith %} - {% endif %} - – -
    - {{ receives.description|convert_markdown(heading_level, html_id) }} -
    -
  • - {% endfor %} -
-
+{% 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:") }} -
    - {% for returns in section.value %} -
  • - {% if returns.name %}{{ returns.name }}{% endif %} - {% if returns.annotation %} - {% with expression = returns.annotation %} - {% if returns.name %}({% endif %} - {% include "expression.html" with context %} - {% if returns.name %}){% endif %} - {% endwith %} - {% endif %} - – -
    - {{ returns.description|convert_markdown(heading_level, html_id) }} -
    -
  • - {% endfor %} -
-
+{% 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:") }} -
    - {% 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 %} -
-
+{% 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:") }} -
    - {% for yields in section.value %} -
  • - {% if yields.name %}{{ yields.name }}{% endif %} - {% if yields.annotation %} - {% with expression = yields.annotation %} - {% if yields.name %}({% endif %} - {% include "expression.html" with context %} - {% if yields.name %}){% endif %} - {% endwith %} - {% endif %} - – -
    - {{ yields.description|convert_markdown(heading_level, html_id) }} -
    -
  • - {% endfor %} -
-
+{% 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" %}