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: |
|
---|---|
license: | BSD. |
Functions¶
babel_extract (fileobj, keywords, ...) |
Babel extraction method for Jinja templates. |
concat |
S.join(iterable) -> unicode |
contextfunction (f) |
This decorator can be used to mark a function or method context callable. |
extract_from_ast (node[, gettext_functions, ...]) |
Extract localizable strings from the given template node. |
import_string (import_name[, silent]) |
Imports an object based on a string. |
iteritems (d) |
|
with_metaclass (meta, *bases) |
Classes¶
AutoEscapeExtension (environment) |
Changes auto escape rules for a scope. |
Environment ([block_start_string, ...]) |
The core component of Jinja is the Environment. |
ExprStmtExtension (environment) |
Adds a do tag to Jinja2 that works like the print statement just that it doesn’t print the return value. |
Extension (environment) |
Extensions can be used to add extra functionality to the Jinja template system at the parser level. |
ExtensionRegistry |
Gives the extension an unique identifier. |
InternationalizationExtension (environment) |
This extension adds gettext support to Jinja2. |
LoopControlExtension (environment) |
Adds break and continue to the template engine. |
Markup |
Marks a string as being safe for inclusion in HTML/XML output without needing to be escaped. |
WithExtension (environment) |
Adds support for a django-like with block. |
autoescape |
alias of AutoEscapeExtension |
do |
alias of ExprStmtExtension |
i18n |
nicer import names |
loopcontrols |
alias of LoopControlExtension |
with_ |
alias of WithExtension |
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. |