summaryrefslogtreecommitdiffstats
path: root/docs/templates/python/material
diff options
context:
space:
mode:
Diffstat (limited to 'docs/templates/python/material')
-rw-r--r--docs/templates/python/material/anta_test.html163
-rw-r--r--docs/templates/python/material/attributes_table.html70
-rw-r--r--docs/templates/python/material/class.html35
-rw-r--r--docs/templates/python/material/docstring.html36
-rw-r--r--docs/templates/python/material/docstring/examples.html14
5 files changed, 318 insertions, 0 deletions
diff --git a/docs/templates/python/material/anta_test.html b/docs/templates/python/material/anta_test.html
new file mode 100644
index 0000000..ade0ba6
--- /dev/null
+++ b/docs/templates/python/material/anta_test.html
@@ -0,0 +1,163 @@
+{% if obj.members %}
+ {{ log.debug("Rendering children of " + obj.path) }}
+
+ <div class="doc doc-children">
+
+ {% 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 class.name == "Input" %}
+ {% filter heading(heading_level, id=html_id ~ "-attributes") %}Inputs{% endfilter %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% set old_obj = obj %}
+ {% set obj = class %}
+ {% include "attributes_table.html" with context %}
+ {% set obj = old_obj %}
+ {% else %}
+ {% if members_list is not none or class.is_public(check_name=False) %}
+ {% include class|get_template with context %}
+ {% endif %}
+ {% 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 %}
+
+ </div>
+{% endif %}
diff --git a/docs/templates/python/material/attributes_table.html b/docs/templates/python/material/attributes_table.html
new file mode 100644
index 0000000..4997145
--- /dev/null
+++ b/docs/templates/python/material/attributes_table.html
@@ -0,0 +1,70 @@
+{% if obj.members %}
+ {{ log.debug("Rendering children of " + obj.path) }}
+
+ <div class="doc doc-children">
+ {# Notice inherited members false #}
+ {% with attributes = obj.attributes|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=false,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Description</th>
+ <th>Default</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for attribute in attributes %}
+ <tr>
+ <td><code>{{ attribute.name }}</code></td>
+ <td>
+ {% if attribute.annotation %}
+ {% with expression = attribute.annotation %}
+ <code>{% include "expression.html" with context %}</code>
+ {% endwith %}
+ {% endif %}
+ </td>
+ <td>
+ <div class="doc-md-description">
+ {{ attribute.docstring.value }}
+ </div>
+ </td>
+ <td>
+ {% if attribute.value %}
+ {% with expression = attribute.value %}
+ <code>{% include "expression.html" with context %}</code>
+ {% endwith %}
+ {% else %}
+ <em>-</em>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {%endwith %}
+ {% with classes = obj.classes|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=false,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% for class in classes %}
+ {% filter heading(heading_level, id=html_id ~ "-attributes") %}{{class.name}}{% endfilter %}
+ <div class="doc doc-children doc-contents">
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% set old_obj = obj %}
+ {% set obj = class %}
+ {% include "attributes_table.html" with context %}
+ {% set obj = old_obj %}
+ </div>
+ {% endfor %}
+ {%endwith %}
+ </div>
+{% endif %}
diff --git a/docs/templates/python/material/class.html b/docs/templates/python/material/class.html
new file mode 100644
index 0000000..940103b
--- /dev/null
+++ b/docs/templates/python/material/class.html
@@ -0,0 +1,35 @@
+{% extends "_base/class.html" %}
+{% set anta_test = namespace(found=false) %}
+{% for base in class.bases %}
+{% set basestr = base | string %}
+{% if "AntaTest" == basestr %}
+{% set anta_test.found = True %}
+{% endif %}
+{% endfor %}
+{% block children %}
+{% if anta_test.found %}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "anta_test.html" with context %}
+ {# render source after children - TODO make add flag to respect disabling it.. though do we want to disable?#}
+ <details class="quote">
+ <summary>Source code in <code>
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+ </code></summary>
+ {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
+ </details>
+{% else %}
+ {{ super() }}
+{% endif %}
+{% endblock children %}
+
+{# Do not render source before children for AntaTest #}
+{% block source %}
+{% if not anta_test.found %}
+ {{ super() }}
+{% endif %}
+{% endblock source %}
diff --git a/docs/templates/python/material/docstring.html b/docs/templates/python/material/docstring.html
new file mode 100644
index 0000000..b12ae7e
--- /dev/null
+++ b/docs/templates/python/material/docstring.html
@@ -0,0 +1,36 @@
+{% if docstring_sections %}
+ {{ log.debug("Rendering docstring") }}
+ {% for section in docstring_sections %}
+ {% if config.show_docstring_description and section.kind.value == "text" %}
+ {% if not (config.anta_hide_test_module_description and module == obj) %}
+ {{ section.value|convert_markdown(heading_level, html_id) }}
+ {% endif %}
+ {% 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 %}
diff --git a/docs/templates/python/material/docstring/examples.html b/docs/templates/python/material/docstring/examples.html
new file mode 100644
index 0000000..d8709c9
--- /dev/null
+++ b/docs/templates/python/material/docstring/examples.html
@@ -0,0 +1,14 @@
+{{ log.debug("Rendering examples section") }}
+
+{% import "language.html" as lang with context %}
+
+<details class="example" open>
+ <summary>{{ "Examples" | convert_markdown(heading_level +1, html_id, strip_paragraph=True) }}</summary>
+ {% 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 %}
+</details>