diff options
author | David Lord <davidism@gmail.com> | 2020-01-26 21:12:52 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-01-26 21:12:52 -0800 |
commit | 4a59ac9514d2ec3cfd8a38780ce81a250e31b692 (patch) | |
tree | fbf137fd6a5c333ced32436e33b614b1fb722a93 /docs | |
parent | 4ec93a454b9b0a95f3772d56ebdac25702268f68 (diff) | |
download | jinja2-4a59ac9514d2ec3cfd8a38780ce81a250e31b692.tar.gz |
Revert "rename imports to jinja"
This reverts commit 1167525b73863119f8bbec03ddb9d35eacff4bef.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.rst | 96 | ||||
-rw-r--r-- | docs/conf.py | 4 | ||||
-rw-r--r-- | docs/examples/cache_extension.py | 4 | ||||
-rw-r--r-- | docs/examples/inline_gettext_extension.py | 8 | ||||
-rw-r--r-- | docs/extensions.rst | 52 | ||||
-rw-r--r-- | docs/faq.rst | 2 | ||||
-rw-r--r-- | docs/integration.rst | 8 | ||||
-rw-r--r-- | docs/intro.rst | 46 | ||||
-rw-r--r-- | docs/nativetypes.rst | 4 | ||||
-rw-r--r-- | docs/sandbox.rst | 4 | ||||
-rw-r--r-- | docs/templates.rst | 8 |
11 files changed, 129 insertions, 107 deletions
diff --git a/docs/api.rst b/docs/api.rst index d1a0a2e..871b326 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,7 +1,7 @@ API === -.. module:: jinja +.. module:: jinja2 :noindex: :synopsis: public Jinja API @@ -27,7 +27,7 @@ are in use. The simplest way to configure Jinja to load templates for your application looks roughly like this:: - from jinja import Environment, PackageLoader, select_autoescape + from jinja2 import Environment, PackageLoader, select_autoescape env = Environment( loader=PackageLoader('yourapplication', 'templates'), autoescape=select_autoescape(['html', 'xml']) @@ -142,7 +142,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions If the environment is sandboxed this attribute is `True`. For the sandbox mode have a look at the documentation for the - :class:`~jinja.sandbox.SandboxedEnvironment`. + :class:`~jinja2.sandbox.SandboxedEnvironment`. .. attribute:: filters @@ -182,7 +182,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions The context used for templates. This should not be changed in most cases, unless you need to modify internals of how template variables are handled. For details, see - :class:`~jinja.runtime.Context`. + :class:`~jinja2.runtime.Context`. .. automethod:: overlay([options]) @@ -251,7 +251,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions .. automethod:: generate_async([context]) -.. autoclass:: jinja.environment.TemplateStream() +.. autoclass:: jinja2.environment.TemplateStream() :members: disable_buffering, enable_buffering, dump @@ -267,14 +267,14 @@ future. It's recommended to configure a sensible default for autoescaping. This makes it possible to enable and disable autoescaping on a per-template basis (HTML versus text for instance). -.. autofunction:: jinja.select_autoescape +.. autofunction:: jinja2.select_autoescape Here a recommended setup that enables autoescaping for templates ending in ``'.html'``, ``'.htm'`` and ``'.xml'`` and disabling it by default -for all other extensions. You can use the :func:`~jinja.select_autoescape` +for all other extensions. You can use the :func:`~jinja2.select_autoescape` function for this:: - from jinja import Environment, select_autoescape + from jinja2 import Environment, select_autoescape env = Environment(autoescape=select_autoescape(['html', 'htm', 'xml']), loader=PackageLoader('mypackage')) @@ -324,7 +324,7 @@ others fail. The closest to regular Python behavior is the :class:`StrictUndefined` which disallows all operations beside testing if it's an undefined object. -.. autoclass:: jinja.Undefined() +.. autoclass:: jinja2.Undefined() .. attribute:: _undefined_hint @@ -352,16 +352,16 @@ disallows all operations beside testing if it's an undefined object. :attr:`_undefined_exception` with an error message generated from the undefined hints stored on the undefined object. -.. autoclass:: jinja.ChainableUndefined() +.. autoclass:: jinja2.ChainableUndefined() -.. autoclass:: jinja.DebugUndefined() +.. autoclass:: jinja2.DebugUndefined() -.. autoclass:: jinja.StrictUndefined() +.. autoclass:: jinja2.StrictUndefined() There is also a factory function that can decorate undefined objects to implement logging on failures: -.. autofunction:: jinja.make_logging_undefined +.. autofunction:: jinja2.make_logging_undefined Undefined objects are created by calling :attr:`undefined`. @@ -393,7 +393,7 @@ Undefined objects are created by calling :attr:`undefined`. The Context ----------- -.. autoclass:: jinja.runtime.Context() +.. autoclass:: jinja2.runtime.Context() :members: resolve, get_exported, get_all .. attribute:: parent @@ -437,7 +437,7 @@ The Context The current :ref:`eval-context`. - .. automethod:: jinja.runtime.Context.call(callable, \*args, \**kwargs) + .. automethod:: jinja2.runtime.Context.call(callable, \*args, \**kwargs) .. admonition:: Implementation @@ -464,24 +464,24 @@ size by default and templates are automatically reloaded. All loaders are subclasses of :class:`BaseLoader`. If you want to create your own loader, subclass :class:`BaseLoader` and override `get_source`. -.. autoclass:: jinja.BaseLoader +.. autoclass:: jinja2.BaseLoader :members: get_source, load Here a list of the builtin loaders Jinja provides: -.. autoclass:: jinja.FileSystemLoader +.. autoclass:: jinja2.FileSystemLoader -.. autoclass:: jinja.PackageLoader +.. autoclass:: jinja2.PackageLoader -.. autoclass:: jinja.DictLoader +.. autoclass:: jinja2.DictLoader -.. autoclass:: jinja.FunctionLoader +.. autoclass:: jinja2.FunctionLoader -.. autoclass:: jinja.PrefixLoader +.. autoclass:: jinja2.PrefixLoader -.. autoclass:: jinja.ChoiceLoader +.. autoclass:: jinja2.ChoiceLoader -.. autoclass:: jinja.ModuleLoader +.. autoclass:: jinja2.ModuleLoader .. _bytecode-cache: @@ -499,10 +499,10 @@ the application. To use a bytecode cache, instantiate it and pass it to the :class:`Environment`. -.. autoclass:: jinja.BytecodeCache +.. autoclass:: jinja2.BytecodeCache :members: load_bytecode, dump_bytecode, clear -.. autoclass:: jinja.bccache.Bucket +.. autoclass:: jinja2.bccache.Bucket :members: write_bytecode, load_bytecode, bytecode_from_string, bytecode_to_string, reset @@ -521,9 +521,9 @@ To use a bytecode cache, instantiate it and pass it to the :class:`Environment`. Builtin bytecode caches: -.. autoclass:: jinja.FileSystemBytecodeCache +.. autoclass:: jinja2.FileSystemBytecodeCache -.. autoclass:: jinja.MemcachedBytecodeCache +.. autoclass:: jinja2.MemcachedBytecodeCache Async Support @@ -569,7 +569,7 @@ Policies Starting with Jinja 2.9 policies can be configured on the environment which can slightly influence how filters and other template constructs behave. They can be configured with the -:attr:`~jinja.Environment.policies` attribute. +:attr:`~jinja2.Environment.policies` attribute. Example:: @@ -626,17 +626,17 @@ Utilities These helper functions and classes are useful if you add custom filters or functions to a Jinja environment. -.. autofunction:: jinja.environmentfilter +.. autofunction:: jinja2.environmentfilter -.. autofunction:: jinja.contextfilter +.. autofunction:: jinja2.contextfilter -.. autofunction:: jinja.evalcontextfilter +.. autofunction:: jinja2.evalcontextfilter -.. autofunction:: jinja.environmentfunction +.. autofunction:: jinja2.environmentfunction -.. autofunction:: jinja.contextfunction +.. autofunction:: jinja2.contextfunction -.. autofunction:: jinja.evalcontextfunction +.. autofunction:: jinja2.evalcontextfunction .. function:: escape(s) @@ -647,11 +647,11 @@ functions to a Jinja environment. The return value is a :class:`Markup` string. -.. autofunction:: jinja.clear_caches +.. autofunction:: jinja2.clear_caches -.. autofunction:: jinja.is_undefined +.. autofunction:: jinja2.is_undefined -.. autoclass:: jinja.Markup([string]) +.. autoclass:: jinja2.Markup([string]) :members: escape, unescape, striptags .. admonition:: Note @@ -664,15 +664,15 @@ functions to a Jinja environment. Exceptions ---------- -.. autoexception:: jinja.TemplateError +.. autoexception:: jinja2.TemplateError -.. autoexception:: jinja.UndefinedError +.. autoexception:: jinja2.UndefinedError -.. autoexception:: jinja.TemplateNotFound +.. autoexception:: jinja2.TemplateNotFound -.. autoexception:: jinja.TemplatesNotFound +.. autoexception:: jinja2.TemplatesNotFound -.. autoexception:: jinja.TemplateSyntaxError +.. autoexception:: jinja2.TemplateSyntaxError .. attribute:: message @@ -695,9 +695,9 @@ Exceptions unicode strings is that Python 2.x is not using unicode for exceptions and tracebacks as well as the compiler. This will change with Python 3. -.. autoexception:: jinja.TemplateRuntimeError +.. autoexception:: jinja2.TemplateRuntimeError -.. autoexception:: jinja.TemplateAssertionError +.. autoexception:: jinja2.TemplateAssertionError .. _writing-filters: @@ -739,7 +739,7 @@ paragraphs and marks the return value as safe HTML string if autoescaping is enabled:: import re - from jinja import evalcontextfilter, Markup, escape + from jinja2 import evalcontextfilter, Markup, escape _paragraph_re = re.compile(r'(?:\r\n|\r(?!\n)|\n){2,}') @@ -805,7 +805,7 @@ must only happen with a :class:`nodes.EvalContextModifier` and :class:`nodes.ScopedEvalContextModifier` from an extension, not on the eval context object itself. -.. autoclass:: jinja.nodes.EvalContext +.. autoclass:: jinja2.nodes.EvalContext .. attribute:: autoescape @@ -928,6 +928,6 @@ could help applications to implement more advanced template concepts. All the functions of the meta API operate on an abstract syntax tree as returned by the :meth:`Environment.parse` method. -.. autofunction:: jinja.meta.find_undeclared_variables +.. autofunction:: jinja2.meta.find_undeclared_variables -.. autofunction:: jinja.meta.find_referenced_templates +.. autofunction:: jinja2.meta.find_referenced_templates diff --git a/docs/conf.py b/docs/conf.py index 1562509..01e530d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,7 +6,7 @@ from pallets_sphinx_themes import ProjectLink project = "Jinja" copyright = "2007 Pallets" author = "Pallets" -release, version = get_version("Jinja") +release, version = get_version("Jinja2") # General -------------------------------------------------------------- @@ -29,7 +29,7 @@ html_context = { "project_links": [ ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"), ProjectLink("Jinja Website", "https://palletsprojects.com/p/jinja/"), - ProjectLink("PyPI releases", "https://pypi.org/project/Jinja/"), + ProjectLink("PyPI releases", "https://pypi.org/project/Jinja2/"), ProjectLink("Source Code", "https://github.com/pallets/jinja/"), ProjectLink("Issue Tracker", "https://github.com/pallets/jinja/issues/"), ] diff --git a/docs/examples/cache_extension.py b/docs/examples/cache_extension.py index f6541c0..387cd46 100644 --- a/docs/examples/cache_extension.py +++ b/docs/examples/cache_extension.py @@ -1,5 +1,5 @@ -from jinja import nodes -from jinja.ext import Extension +from jinja2 import nodes +from jinja2.ext import Extension class FragmentCacheExtension(Extension): diff --git a/docs/examples/inline_gettext_extension.py b/docs/examples/inline_gettext_extension.py index 61b525a..47bc9cc 100644 --- a/docs/examples/inline_gettext_extension.py +++ b/docs/examples/inline_gettext_extension.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import re -from jinja.exceptions import TemplateSyntaxError -from jinja.ext import Extension -from jinja.lexer import count_newlines -from jinja.lexer import Token +from jinja2.exceptions import TemplateSyntaxError +from jinja2.ext import Extension +from jinja2.lexer import count_newlines +from jinja2.lexer import Token _outside_re = re.compile(r"\\?(gettext|_)\(") diff --git a/docs/extensions.rst b/docs/extensions.rst index 37eb732..7abed65 100644 --- a/docs/extensions.rst +++ b/docs/extensions.rst @@ -14,10 +14,10 @@ Adding Extensions Extensions are added to the Jinja environment at creation time. Once the environment is created additional extensions cannot be added. To add an extension pass a list of extension classes or import paths to the -``extensions`` parameter of the :class:`~jinja.Environment` constructor. The following +``extensions`` parameter of the :class:`~jinja2.Environment` constructor. The following example creates a Jinja environment with the i18n extension loaded:: - jinja_env = Environment(extensions=['jinja.ext.i18n']) + jinja_env = Environment(extensions=['jinja2.ext.i18n']) .. _i18n-extension: @@ -25,7 +25,7 @@ example creates a Jinja environment with the i18n extension loaded:: i18n Extension -------------- -**Import name:** ``jinja.ext.i18n`` +**Import name:** ``jinja2.ext.i18n`` The i18n extension can be used in combination with `gettext`_ or `Babel`_. When it's enabled, Jinja provides a ``trans`` statement that @@ -41,7 +41,7 @@ Environment Methods After enabling the extension, the environment provides the following additional methods: -.. method:: jinja.Environment.install_gettext_translations(translations, newstyle=False) +.. method:: jinja2.Environment.install_gettext_translations(translations, newstyle=False) Installs a translation globally for the environment. The ``translations`` object must implement ``gettext`` and ``ngettext`` @@ -51,7 +51,7 @@ additional methods: .. versionchanged:: 2.5 Added new-style gettext support. -.. method:: jinja.Environment.install_null_translations(newstyle=False) +.. method:: jinja2.Environment.install_null_translations(newstyle=False) Install no-op gettext functions. This is useful if you want to prepare the application for internationalization but don't want to @@ -59,7 +59,7 @@ additional methods: .. versionchanged:: 2.5 Added new-style gettext support. -.. method:: jinja.Environment.install_gettext_callables(gettext, ngettext, newstyle=False) +.. method:: jinja2.Environment.install_gettext_callables(gettext, ngettext, newstyle=False) Install the given ``gettext`` and ``ngettext`` callables into the environment. They should behave exactly like @@ -71,11 +71,11 @@ additional methods: .. versionadded:: 2.5 Added new-style gettext support. -.. method:: jinja.Environment.uninstall_gettext_translations() +.. method:: jinja2.Environment.uninstall_gettext_translations() Uninstall the environment's globally installed translation. -.. method:: jinja.Environment.extract_translations(source) +.. method:: jinja2.Environment.extract_translations(source) Extract localizable strings from the given template node or source. @@ -100,7 +100,7 @@ installed when the environment is created. .. code-block:: python translations = get_gettext_translations() - env = Environment(extensions=["jinja.ext.i18n"]) + env = Environment(extensions=["jinja2.ext.i18n"]) env.install_gettext_translations(translations) The ``get_gettext_translations`` function would return the translator @@ -182,7 +182,7 @@ The advantages of newstyle gettext are: Expression Statement -------------------- -**Import name:** ``jinja.ext.do`` +**Import name:** ``jinja2.ext.do`` The "do" aka expression-statement extension adds a simple ``do`` tag to the template engine that works like a variable expression but ignores the @@ -193,7 +193,7 @@ return value. Loop Controls ------------- -**Import name:** ``jinja.ext.loopcontrols`` +**Import name:** ``jinja2.ext.loopcontrols`` This extension adds support for ``break`` and ``continue`` in loops. After enabling, Jinja provides those two keywords which work exactly like in @@ -204,7 +204,7 @@ Python. With Statement -------------- -**Import name:** ``jinja.ext.with_`` +**Import name:** ``jinja2.ext.with_`` .. versionchanged:: 2.9 @@ -215,7 +215,7 @@ With Statement Autoescape Extension -------------------- -**Import name:** ``jinja.ext.autoescape`` +**Import name:** ``jinja2.ext.autoescape`` .. versionchanged:: 2.9 @@ -228,7 +228,7 @@ Autoescape Extension Debug Extension --------------- -**Import name:** ``jinja.ext.debug`` +**Import name:** ``jinja2.ext.debug`` Adds a ``{% debug %}`` tag to dump the current context as well as the available filters and tests. This is useful to see what's available to @@ -240,7 +240,7 @@ use in the template without setting up a debugger. Writing Extensions ------------------ -.. module:: jinja.ext +.. module:: jinja2.ext By writing extensions you can add custom tags to Jinja. This is a non-trivial task and usually not needed as the default tags and expressions cover all @@ -269,7 +269,7 @@ The following example implements a ``cache`` tag for Jinja by using the And here is how you use it in an environment:: - from jinja import Environment + from jinja2 import Environment from cachelib import SimpleCache env = Environment(extensions=[FragmentCacheExtension]) @@ -313,7 +313,7 @@ Extension API Extension ~~~~~~~~~ -Extensions always have to extend the :class:`jinja.ext.Extension` class: +Extensions always have to extend the :class:`jinja2.ext.Extension` class: .. autoclass:: Extension :members: preprocess, filter_stream, parse, attr, call_method @@ -336,7 +336,7 @@ The parser passed to :meth:`Extension.parse` provides ways to parse expressions of different types. The following methods may be used by extensions: -.. autoclass:: jinja.parser.Parser +.. autoclass:: jinja2.parser.Parser :members: parse_expression, parse_tuple, parse_assign_target, parse_statements, free_identifier, fail @@ -353,16 +353,16 @@ extensions: .. attribute:: stream - The current :class:`~jinja.lexer.TokenStream` + The current :class:`~jinja2.lexer.TokenStream` -.. autoclass:: jinja.lexer.TokenStream +.. autoclass:: jinja2.lexer.TokenStream :members: push, look, eos, skip, __next__, next_if, skip_if, expect .. attribute:: current - The current :class:`~jinja.lexer.Token`. + The current :class:`~jinja2.lexer.Token`. -.. autoclass:: jinja.lexer.Token +.. autoclass:: jinja2.lexer.Token :members: test, test_any .. attribute:: lineno @@ -381,7 +381,7 @@ extensions: There is also a utility function in the lexer module that can count newline characters in strings: -.. autofunction:: jinja.lexer.count_newlines +.. autofunction:: jinja2.lexer.count_newlines AST @@ -395,10 +395,10 @@ execute custom Python code. The list below describes all nodes that are currently available. The AST may change between Jinja versions but will stay backwards compatible. -For more information have a look at the repr of :meth:`jinja.Environment.parse`. +For more information have a look at the repr of :meth:`jinja2.Environment.parse`. -.. module:: jinja.nodes +.. module:: jinja2.nodes -.. jinja:nodes:: jinja.nodes.Node +.. jinja:nodes:: jinja2.nodes.Node .. autoexception:: Impossible diff --git a/docs/faq.rst b/docs/faq.rst index da84368..294fef1 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -145,7 +145,7 @@ work in production environments:: sandbox._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt'] Credit for this snippet goes to `Thomas Johansson -<https://stackoverflow.com/a/3694434>`_ +<https://stackoverflow.com/questions/3086091/debug-jinja2-in-google-app-engine/3694434#3694434>`_ Why is there no Python 2.3/2.4/2.5/2.6/3.1/3.2/3.3 support? ----------------------------------------------------------- diff --git a/docs/integration.rst b/docs/integration.rst index a7a6fe3..2cfad55 100644 --- a/docs/integration.rst +++ b/docs/integration.rst @@ -14,7 +14,7 @@ Babel Integration ----------------- Jinja provides support for extracting gettext messages from templates via a -`Babel`_ extractor entry point called `jinja.ext.babel_extract`. The Babel +`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. @@ -24,7 +24,7 @@ in its Babel extraction method `mapping file`_: .. sourcecode:: ini - [jinja: **/templates/**.html] + [jinja2: **/templates/**.html] encoding = utf-8 The syntax related options of the :class:`Environment` are also available as @@ -33,7 +33,7 @@ that templates use ``%`` as `line_statement_prefix` you can use this code: .. sourcecode:: ini - [jinja: **/templates/**.html] + [jinja2: **/templates/**.html] encoding = utf-8 line_statement_prefix = % @@ -61,7 +61,7 @@ Pylons powered application. The template engine is configured in `config/environment.py`. The configuration for Jinja looks something like that:: - from jinja import Environment, PackageLoader + from jinja2 import Environment, PackageLoader config['pylons.app_globals'].jinja_env = Environment( loader=PackageLoader('yourapplication', 'templates') ) diff --git a/docs/intro.rst b/docs/intro.rst index cf0fc7d..c20c5e9 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -9,29 +9,51 @@ Django, you should feel right at home with Jinja. It's both designer and developer friendly by sticking to Python's principles and adding functionality useful for templating environments. - Prerequisites ------------- -Jinja works with Python >= 3.5 and 2.7. - -Jinja depends on `MarkupSafe`_. If you install via ``pip`` it will be -installed automatically. - -.. _MarkupSafe: https://markupsafe.palletsprojects.com/ +Jinja works with Python 2.7.x and >= 3.5. If you are using Python +3.2 you can use an older release of Jinja (2.6) as support for Python 3.2 +was dropped in Jinja version 2.7. The last release which supported Python 2.6 +and 3.3 was Jinja 2.10. +If you wish to use the :class:`~jinja2.PackageLoader` class, you will also +need `setuptools`_ or `distribute`_ installed at runtime. Installation ------------ You can install the most recent Jinja version using `pip`_:: - pip install Jinja + pip install Jinja2 This will install Jinja in your Python installation's site-packages directory. +Installing the development version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install `git`_ +2. ``git clone git://github.com/pallets/jinja.git`` +3. ``cd jinja2`` +4. ``ln -s jinja2 /usr/lib/python2.X/site-packages`` + +As an alternative to steps 4 you can also do ``python setup.py develop`` +which will install the package via `distribute` in development mode. This also +has the advantage that the C extensions are compiled. + +.. _distribute: https://pypi.org/project/distribute/ +.. _setuptools: https://pypi.org/project/setuptools/ .. _pip: https://pypi.org/project/pip/ +.. _git: https://git-scm.com/ + + +MarkupSafe Dependency +~~~~~~~~~~~~~~~~~~~~~ +As of version 2.7 Jinja depends on the `MarkupSafe`_ module. If you install +Jinja via ``pip`` it will be installed automatically for you. + +.. _MarkupSafe: https://markupsafe.palletsprojects.com/ Basic API Usage --------------- @@ -40,17 +62,17 @@ This section gives you a brief introduction to the Python API for Jinja templates. The most basic way to create a template and render it is through -:class:`~jinja.Template`. This however is not the recommended way to +:class:`~jinja2.Template`. This however is not the recommended way to work with it if your templates are not loaded from strings but the file system or another data source: ->>> from jinja import Template +>>> from jinja2 import Template >>> template = Template('Hello {{ name }}!') >>> template.render(name='John Doe') u'Hello John Doe!' -By creating an instance of :class:`~jinja.Template` you get back a new template -object that provides a method called :meth:`~jinja.Template.render` which when +By creating an instance of :class:`~jinja2.Template` you get back a new template +object that provides a method called :meth:`~jinja2.Template.render` which when called with a dict or keyword arguments expands the template. The dict or keywords arguments passed to the template are the so-called "context" of the template. diff --git a/docs/nativetypes.rst b/docs/nativetypes.rst index a5258aa..1a08700 100644 --- a/docs/nativetypes.rst +++ b/docs/nativetypes.rst @@ -1,11 +1,11 @@ -.. module:: jinja.nativetypes +.. module:: jinja2.nativetypes .. _nativetypes: Native Python Types =================== -The default :class:`~jinja.Environment` renders templates to strings. With +The default :class:`~jinja2.Environment` renders templates to strings. With :class:`NativeEnvironment`, rendering a template produces a native Python type. This is useful if you are using Jinja outside the context of creating text files. For example, your code may have an intermediate step where users may use diff --git a/docs/sandbox.rst b/docs/sandbox.rst index bd8abcf..1222d02 100644 --- a/docs/sandbox.rst +++ b/docs/sandbox.rst @@ -17,7 +17,7 @@ SecurityError: access to attribute 'func_code' of 'function' object is unsafe. API --- -.. module:: jinja.sandbox +.. module:: jinja2.sandbox .. autoclass:: SandboxedEnvironment([options]) :members: is_safe_attribute, is_safe_callable, default_binop_table, @@ -77,7 +77,7 @@ operator symbols into callbacks performing the default operator behavior. This example shows how the power (``**``) operator can be disabled in Jinja:: - from jinja.sandbox import SandboxedEnvironment + from jinja2.sandbox import SandboxedEnvironment class MyEnvironment(SandboxedEnvironment): diff --git a/docs/templates.rst b/docs/templates.rst index f9504c1..89c2a50 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -1425,7 +1425,7 @@ is a bit contrived in the context of rendering a template): List of Builtin Filters ----------------------- -.. jinja:filters:: jinja.defaults.DEFAULT_FILTERS +.. jinja:filters:: jinja2.defaults.DEFAULT_FILTERS .. _builtin-tests: @@ -1433,7 +1433,7 @@ List of Builtin Filters List of Builtin Tests --------------------- -.. jinja:tests:: jinja.defaults.DEFAULT_TESTS +.. jinja:tests:: jinja2.defaults.DEFAULT_TESTS .. _builtin-globals: @@ -1731,9 +1731,9 @@ without setting up a debugger. .. code-block:: text - {'context': {'cycler': <class 'jinja.utils.Cycler'>, + {'context': {'cycler': <class 'jinja2.utils.Cycler'>, ..., - 'namespace': <class 'jinja.utils.Namespace'>}, + 'namespace': <class 'jinja2.utils.Namespace'>}, 'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd', ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'], 'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined', |