8000 docs: Document Jinja templates by pawamoy · Pull Request #156 · mkdocstrings/python · GitHub
[go: up one dir, main page]

Skip to content

docs: Document Jinja templates #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! docs: Document Jinja templates
  • Loading branch information
pawamoy committed Apr 28, 2024
commit 1ff3ac0810b8c580d3b71a4dc6b13646d1f14c24
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% endblock logs %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<p><span class="doc-section-title">{{ section.title or lang.t("Examples:") }}</span></p>
{% for section_type, sub_section in section.value %}
Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Context:
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Other parameters" sections in docstrings.

This template renders a list of documented other parameters 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Parameters" sections in docstrings.

This template renders a list of documented parameters 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Raises" sections in docstrings.

This template renders a list of documented exceptions 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Receives" sections in docstrings.

This template renders a list of documented received values (generators) 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Returns" sections in docstrings.

This template renders a list of documented returned values 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Warns" sections in docstrings.

This template renders a list of documented warnings 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{#- Template for "Yields" sections in docstrings.

This template renders a list of documented yielded values (generators) 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() }}
{% endblock %}

{% import "language"|get_template as lang with context %}
{#- Language module providing the `t` translation method. -#}

<table class="field-list">
<colgroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{#- Import translation macros for the given language and fallback language. -#}

{% block logs scoped %}
{#- Logging block.

This block can be used to log debug messages, deprecation messages, warnings, etc.
-#}
{% endblock logs %}
<!-- Import translations for given language and fallback -->

{% set lang_pth = "languages/" ~ locale | get_template %}
{% if lang_pth is existing_template %}
{% import lang_pth as lang %}
Expand All @@ -9,4 +15,4 @@
{% else %}
{% import "languages/en"|get_template as lang %}
{% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
{% endif %}
{% endif %}
0