jinja2.ext

jinja2.ext

Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two example extensions exist: an i18n and a cache extension.

copyright:
  1. 2010 by the Jinja Team.
license:

BSD.

Classes

AutoEscapeExtension Changes auto escape rules for a scope.
ExprStmtExtension Adds a do tag to Jinja2 that works like the print statement just
Extension Extensions can be used to add extra functionality to the Jinja template
ExtensionRegistry Gives the extension an unique identifier.
InternationalizationExtension This extension adds gettext support to Jinja2.
LoopControlExtension Adds break and continue to the template engine.
WithExtension Adds support for a django-like with block.
autoescape Changes auto escape rules for a scope.
do Adds a do tag to Jinja2 that works like the print statement just
i18n This extension adds gettext support to Jinja2.
loopcontrols Adds break and continue to the template engine.
with_ Adds support for a django-like with block.

Exceptions

TemplateAssertionError(message, lineno[, ...]) Like a template syntax error, but covers cases where something in the template caused an error at compile time that wasn’t necessarily caused by a syntax error.
TemplateSyntaxError(message, lineno[, name, ...]) Raised to tell the user that there is a problem with the template.

Functions

babel_extract(fileobj, keywords, ...) Babel extraction method for Jinja templates.
concat S.join(iterable) -> unicode
extract_from_ast(node[, gettext_functions, ...]) Extract localizable strings from the given template node.
next(iterator[, default]) Return the next item from the iterator.

Defined

  • BLOCK_END_STRING
  • BLOCK_START_STRING
  • COMMENT_END_STRING
  • COMMENT_START_STRING
  • DEFAULT_FILTERS
  • DEFAULT_NAMESPACE
  • DEFAULT_TESTS
  • Environment
  • GETTEXT_FUNCTIONS
  • LINE_COMMENT_PREFIX
  • LINE_STATEMENT_PREFIX
  • Markup
  • NEWLINE_SEQUENCE
  • TRIM_BLOCKS
  • Undefined
  • VARIABLE_END_STRING
  • VARIABLE_START_STRING
  • contextfunction
  • deque
  • import_string
  • nodes

Table Of Contents

Previous topic

UndefinedError

Next topic

AutoEscapeExtension Class