=========
Utilities
=========

Jinja comes with some utility tags shipped. Those arn't necessary but can help
you with your templates.


Capture Output
==============

Captures output and stores it in a variable::

    {% capture as loopdata %}
        {% for item in navigation %}
            <li><a href="{{ item.href }}">{{ item.caption|escapexml }}</a></li>
        {% endfor %}
    {% endcapture %}

The output of the for loop is now stored in the variable ``loopdata``.

This allows the double usage of block tags::

    {% capture as title %}{% marker "title" %}{% endcapture %}
    <html>
        <head>
            <title>{{ title|escapexml }} | My Webpage</title>
        </head>
        <body>
            <h1>{{ title }}</h1>
            {% marker "body" %}
        </body>
    </html>


Modify / Set Variables
======================

``{% define %}`` allows you to set a variable.

Usage::

    {% define my_variable "Some Value" %}

You can also apply filters::

    {% define escaped content | escapexml %}

