Current File : //usr/share/doc/python-jinja2-2.7.2/html/_sources/integration.txt
Integration
===========

Jinja2 provides some code for integration into other tools such as frameworks,
the `Babel`_ library or your favourite editor for fancy code highlighting.
This is a brief description of whats included.

Files to help integration are available
`here. <https://github.com/mitsuhiko/jinja2/tree/master/ext>`_

.. _babel-integration:

Babel Integration
-----------------

Jinja provides support for extracting gettext messages from templates via a
`Babel`_ extractor entry point called `jinja2.ext.babel_extract`.  The Babel
support is implemented as part of the :ref:`i18n-extension` extension.

Gettext messages extracted from both `trans` tags and code expressions.

To extract gettext messages from templates, the project needs a Jinja2 section
in its Babel extraction method `mapping file`_:

.. sourcecode:: ini

    [jinja2: **/templates/**.html]
    encoding = utf-8

The syntax related options of the :class:`Environment` are also available as
configuration values in the mapping file.  For example to tell the extraction
that templates use ``%`` as `line_statement_prefix` you can use this code:

.. sourcecode:: ini

    [jinja2: **/templates/**.html]
    encoding = utf-8
    line_statement_prefix = %

:ref:`jinja-extensions` may also be defined by passing a comma separated list
of import paths as `extensions` value.  The i18n extension is added
automatically.

.. versionchanged:: 2.7

   Until 2.7 template syntax errors were always ignored.  This was done
   since many people are dropping non template html files into the
   templates folder and it would randomly fail.  The assumption was that
   testsuites will catch syntax errors in templates anyways.  If you don't
   want that behavior you can add ``silent=false`` to the settings and
   exceptions are propagated.

.. _mapping file: http://babel.edgewall.org/wiki/Documentation/messages.html#extraction-method-mapping-and-configuration

Pylons
------

With `Pylons`_ 0.9.7 onwards it's incredible easy to integrate Jinja into a
Pylons powered application.

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

    from jinja2 import Environment, PackageLoader
    config['pylons.app_globals'].jinja_env = Environment(
        loader=PackageLoader('yourapplication', 'templates')
    )

After that you can render Jinja templates by using the `render_jinja` function
from the `pylons.templating` module.

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 return
an empty string and not an undefined object.  To change this just use this
snippet and add it into your `config/environment.py`::

    config['pylons.strict_c'] = True

.. _Pylons: http://www.pylonshq.com/

TextMate
--------

Inside the `ext` folder at the root of the Jinja2 project there is a bundle for
TextMate that supports syntax highlighting for Jinja1 and Jinja2 for text based
templates as well as HTML.  It also contains a few often used snippets.

Vim
---

A syntax plugin for `Vim`_ exists in the Vim-scripts directory as well as the
`ext` folder at the root of the Jinja2 project.  `The script
<http://www.vim.org/scripts/script.php?script_id=1856>`_ supports Jinja1 and
Jinja2.  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.

.. _Babel: http://babel.edgewall.org/
.. _Vim: http://www.vim.org/
blog

blog

Meilleur Casino en ligne 2025 – Classement complet.4306

Содержимое Les meilleurs casinos en ligne pour jouer en 2025 Comment choisir le meilleur casino en ligne pour vous Les critères pour choisir le meilleur casino en ligne Meilleur Casino en ligne 2025 – Classement complet Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience …

Read More »

Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables.4313

Содержимое Les Critères de Sélection Les Meilleurs Casinos en Ligne 2025 Les Critères de Sélection Les Meilleurs Casinos en Ligne 2025 Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience de jeu en ligne …

Read More »

Chicken Road slot w kasynie online jak grać.791

Содержимое Wprowadzenie do gry Chicken Road Slot Zasady gry i bonusy w grze Chicken Road Chicken Road slot w kasynie online – jak grać Wśród wielu slotów, które możemy znaleźć w kasynach online, jeden z nich wyróżnia się swoją oryginalnością i fascynującą atmosferą – chicken road . To nie tylko …

Read More »

Chicken Road slot w kasynie online dostępność mobilna.875

Содержимое Wprowadzenie do gry Chicken Road Slot Wymagania gry Jak grać w Chicken Road Slot? Zasady gry i bonusy w grze Chicken Road Wyniki testu: jak gra się w mobilnym wersji Chicken Road Slot Chicken Road slot w kasynie online – dostępność mobilna Wśród wielu slotów dostępnych w kasynach online, …

Read More »

Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables.2758

Содержимое Les Meilleurs Casinos en Ligne pour les Joueurs Français Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience de jeu en ligne sécurisée et amusante. Mais comment choisir le meilleur casino en ligne …

Read More »

Gioco Plinko nei casinò online in Italia.1242

Gioco Plinko nei casinò online in Italia ▶️ GIOCARE Содержимое La storia dietro il gioco Le origini del gioco La versione online Come funziona il gioco Plinko Le strategie per vincere al Plinko Le migliori piattaforme per giocare Plinko in Italia Consigli per giocatori esordienti Capisci il funzionamento del gioco …

Read More »

казино – Официальный сайт Pin Up Casino вход на зеркало.858

Пин Ап казино – Официальный сайт Pin Up Casino вход на зеркало ▶️ ИГРАТЬ Содержимое Pin Up Casino – Официальный сайт Вход на зеркало Преимущества использования зеркала В современном мире азартных игр, где каждый день появляются новые онлайн-казино, сложно найти надежный и проверенный игрок. Однако, pin up Casino – это …

Read More »