Jinja2 Templating with JSON files
Project description
jjtemplate
Jinja2 Templating with JSON files
Example
example.txt.jinja
:
Hello, {{ name }}.
example.json
:
{
"name": "world"
}
You run:
$ jjtemplate -o result.txt example.txt.jinja example.json
Then you get result.txt
:
Hello, world.
Install
$ pip install jjtemplate
Usage
usage: jjtemplate [-h] [-i IMPORT_NAME] [-o OUTPUT] template_file [json_files ...]
positional arguments:
template_file Jinja2 template file
json_files JSON files loaded to the context (top-level object must
be a dictionary)
optional arguments:
-h, --help show this help message and exit
-i IMPORT_NAME, --import IMPORT_NAME
import Python module to the context (can be put
multiple times)
-o OUTPUT, --output OUTPUT
output file name
Installed jjtemplate
command runs main
function of jjtemplate.py
, which
is the sole entire content of the module.
You can copy jjtemplate.py
and add it to your project freely. See the
License section bellow.
References
License
jjtemplate is marked with CC0 1.0. To view a copy of this license, visit <https://creativecommons.org/publicdomain/zero/1.0/>.
(In other words, public domain.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jjtemplate-0.9.0.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file jjtemplate-0.9.0.tar.gz
.
File metadata
- Download URL: jjtemplate-0.9.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a92c2ed8bd645b725c5f19871bd16d1d3c3a62513dd271a7b3ffc569d7e22300 |
|
MD5 | b96d57f7cd9e7afd04512602445276c8 |
|
BLAKE2b-256 | 4802614fd08fc35318696434b14f2cadc063bf45cbbac29e02af1c5775656879 |
File details
Details for the file jjtemplate-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: jjtemplate-0.9.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b28072163edd3b5d5f0119bf77e27c0dadd43e22c4980416445fd917ed34c9e1 |
|
MD5 | d8fb166a555812955141e62a487d1956 |
|
BLAKE2b-256 | 36f310084b790c2958408d686de95a5cf4c45b7883d3b389495c9f8ee9f059f8 |