Integration¶

    Files to help integration are availablehere.

    Jinja provides support for extracting gettext messages from templates via a extractor entry point called jinja2.ext.babel_extract. The Babelsupport is implemented as part of the i18n Extension extension.

    Gettext messages extracted from both trans tags and code expressions.

    To extract gettext messages from templates, the project needs a Jinja2 sectionin its Babel extraction method :

    Extensions may also be defined by passing a comma separated listof import paths as extensions value. The i18n extension is addedautomatically.

    Changed in version 2.7: Until 2.7 template syntax errors were always ignored. This was donesince many people are dropping non template html files into thetemplates folder and it would randomly fail. The assumption was thattestsuites will catch syntax errors in templates anyways. If you don’twant that behavior you can add to the settings andexceptions are propagated.

    With 0.9.7 onwards it’s incredible easy to integrate Jinja into aPylons powered application.

    The template engine is configured in config/environment.py. The configurationfor Jinja2 looks something like that:

    Additionally it’s a good idea to set the Pylons’ c object into strict mode.Per default any attribute to not existing attributes on the c object returnan empty string and not an undefined object. To change this just use thissnippet and add it into your config/environment.py:

    There is a bundle for TextMate that supports syntax highlighting for Jinja1 and Jinja2 for text basedtemplates as well as HTML. It also contains a few often used snippets.

    A syntax plugin for exists in the Vim-scripts directory as well as theext folder at the root of the Jinja2 project. The script supports Jinja1 andJinja2. Once installed two file types are available jinja and htmljinja.The first one for text based templates, the latter for HTML templates.

    Copy the files into your syntax folder.