=========== Basic Usage =========== The Jinja template language is designed to strike a balance between content and application logic. How does it look like? ====================== Here is a small example template:: My Webpage

My Webpage

{{ variable }} Context ======= The application developer provides a list of variables called context. Normally there should be a documentation but if you want to know the content of the current context you can add this to your template::
{% debug %}
You can print a context variable using ``{% print var %}`` or the shortcut form: ``{{ var }}``. A context isn't flat which means that each variable can has subvariables, as long as it is representable as python data structure. You can access attributes, dictionary values... using a dot ".":: {{ userlist.0.username }} --> context['userlist'][0]['username'] {{ object.attribute }} --> context['object']['attribute'] {{ item.caption }} --> context['item']['caption'] Applying Filters ================ Jinja provides a simple but powerful filter system, which works like piping on UNIX systems. Here a small example:: {{ variable|replace "search", "replace"|escapexml }} You can put Whitespaces between filters if you like:: {{ variable | repalce "search", "replace" | escapexml }} This will look for a variable ``variable``, passes it to the filter ``replace`` with the arguments "search" and "replace", and passes the result to the filter ``escapexml``. For a list of available filters have a look at the `filter list`_. .. _filter list: filters.txt