Jinja 1.0 Released

Armin Ronacher armin.ronacher at active-4.com
Fri Mar 23 17:05:28 CET 2007


Jinja 1.0 Released
==================

Jinja 1.0 is out now. Jinja is a sandboxed  template engine written in
pure Python
licensed under the BSD license. It provides a Django-like non-XML
syntax and
compiles templates into executable python code. It's basically a
combination
of Django templates and python code.

Differences to Django
---------------------

While the Jinja default syntax looks pretty much like Django the rest
of the
template engine works completely different. Jinja was designed to be
used
without Django and to support Python expressions.

Features that Jinja has in common with Django:

    * filter functions
    * block based template inheritance
    * the {% cycle %} and {% filter %} tag
    * being sandboxed
    * similar default syntax

Differences:

    * advanced lexer that allows escaping of tags
    * generation of bytecode for faster template execution
    * definition of macros (often recurring tasks like rendering
dialog
      boxes, form elements etc.)
    * raw blocks
    * uncoupled internationalization support
    * expression support in any tag
    * abbility of modifying the context from the template by using the
      {% set %} tag.
    * support for function calling with arguments
    * filters can be called with a variable argument count
    * full unicode support
    * deferred objects (objects that are resolved on first access, not
on
      context instanciation)
    * Missing support for {{ block.super }}
    * Support for recursing by using recursing for loops or self
calling
      macros.
    * If blocks have support for multiple elif statements
    * for loops have an optional else block executed if there was no
      iteration.
    * test functions like is even etc.
    * block delimiters are exchangeable.
    * no implicit function calling
    * {% endblock %} doesn't support the optional name argument
    * {% ifchanged %} is not implemented because of performance
reasons.
      If there's enough interest an implementation might be added
    * {% templatetag %} is not implemented because Jinja supports
escaping
      via {% raw %} or the variable syntax
    * {% comment %} is not implemented, rather use for commenting out
stuff.
    * {% now %} is not implemented because Jinja doesn't handle l10n.
      Datetime specific stuff should be provided by the application.
    * {% load %}, loading components for Jinja works from the
application
      side. Template designers don't have to import stuff on their
own.
    * {% debug %} is not implemented. You can use the global function
debug().
    * custom tags are not supported. Most of the stuff that is
possible with
      django template tags is possible with either functions, filters,
tests
      or a combination of them.
    * using keywords like endfor as identifer raises an exception.

Links
-----

    * Webpage - http://jinja.pocoo.org/
    * Downloads - http://jinja.pocoo.org/download.html
    * Documentation - http://jinja.pocoo.org/documentation/



More information about the Python-announce-list mailing list