Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ondratu/jinja2-template-info
Simple code, which generate tempate_info to output with Jinja2.
https://github.com/ondratu/jinja2-template-info
Last synced: 3 months ago
JSON representation
Simple code, which generate tempate_info to output with Jinja2.
- Host: GitHub
- URL: https://github.com/ondratu/jinja2-template-info
- Owner: ondratu
- License: other
- Created: 2018-06-20T06:26:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-30T07:16:45.000Z (almost 3 years ago)
- Last Synced: 2024-06-02T13:06:47.495Z (7 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: ChangeLog
- Funding: .github/FUNDING.yml
- License: COPYING
Awesome Lists containing this project
README
Jinja2 template info
====================Jinja2-template_info is Jinja2 Extension module and piece of code to generate
and show some template information which could help with debuging templates.``template_info``
-----------------``render(template, path, **kwargs)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That is simple function, which return rendered string from Jinja2. If there is
``debug`` variable set to positive variable in ``kawrgs``,
``TemplateInfoExtension`` is used and attributes ``data`` and ``template`` was
set.:template: template file name
:path: path or paths, where jinja could find the template
:\**kwargs: data, which are send to template.. code:: python
>>> try:
... from importlib.resources import files
... except ImportError:
... from importlib_resources import files
>>> from jinja2_template_info import render
>>> path = (files('jinja2_template_info'), "./")
>>> render("test.html", path, debug=True,
... code_variable="Variable from code")
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
'...