<commit_before>Tags
====

.. py:module:: knights.tags

Default tags.

.. py:function:: load name

   Loads template library ``name``.

.. py:function:: extends name

   Make this Template class extend the template in ``name``

.. py:function:: block name

   Declares a new overridable block in the template.

   This will result in a new method on the class of the same name, so names
   must be valid Python identifiers.

.. py:function:: if expr

   Implements a simple if conditional.

   .. code-block:: html

      {% if ...expr... %}
      ...
      {% endif %}

   Optionally, it may contain an else:

   .. code-block:: html

      {% if ...expre... %}
      ...
      {% else %}
      ...
      {% endif %}

.. py:function:: for

   A python compatible {% for %} tag.

.. py:function:: include

   Include another template in situ, using the current context.

   .. code-block:: html

      {% include "othertemplate.html" %}

   Optionally, you can update the context by passing keyword arguments:

   .. code-block:: html

      {% include "other.html" foo=1, bar=baz * 6 %}

.. py:function:: with

   Temporarily augment the current context.

   .. code-block:: html

      {% with ...kwargs... %}
      ...
      {% endwith %}<commit_msg>Flesh out the docs with examples<commit_after>Tags
====

.. py:module:: knights.tags

Default tags.

.. py:function:: load name

   .. code-block:: html

      {% load foo.bar.baz %}

   Loads template library ``name``.

   The name is treated as a python import path, and the loaded module is
   expected to have a 'register' member, being an instance of :library:Library

.. py:function:: extends name

   .. code-block:: html

      {% extends base.html %}

   Make this Template class extend the template in ``name``

.. py:function:: block name

   .. code-block:: html

      {% block foo %}
      ...
      {% endblock %}

   Declares a new overridable block in the template.

   This will result in a new method on the class of the same name, so names
   must be valid Python identifiers.

.. py:function:: if expr

   Implements a simple if conditional.

   .. code-block:: html

      {% if ...expr... %}
      ...
      {% endif %}

   Optionally, it may contain an else:

   .. code-block:: html

      {% if ...expre... %}
      ...
      {% else %}
      ...
      {% endif %}

.. py:function:: for

   .. code-block:: html

      {% for a in sequence %}
      ...
      {% endfor %}

   A python compatible {% for %} tag.

   .. code-block:: html

      {% for a, b, c in foo.get(other=1) %}
      ...
      {% endfor %}

   The target values will be stacked on the scope for the duration, and removed
   once the loop exits.

.. py:function:: include

   Include another template in situ, using the current context.

   .. code-block:: html

      {% include "othertemplate.html" %}

   Optionally, you can update the context by passing keyword arguments:

   .. code-block:: html

      {% include "other.html" foo=1, bar=baz * 6 %}

.. py:function:: with

   Temporarily augment the current context.

   .. code-block:: html

      {% with ...kwargs... %}
      ...
      {% endwith %}
{'fraction_non_alphanumeric': 0.13724247226624406, 'fraction_numerical': 0.001584786053882726, 'mean_word_length': 2.0640776699029124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '52337', 'n_tokens_mistral': 1005, 'n_tokens_neox': 876, 'n_words': 341}