Jinja2 compiler
Project description
version number: 0.2.1 author: Tom Tang
Overview
Jinja2 compiler
Installation / Usage
To install use pip:
$ pip install jj2c
To use it:
Render from folder to folder: jj2c template_folder/ -V 'a: AAA' 'b: BBB' -o output_folder/
Render from zip to folder: jj2c template.zip -V 'a: AAA' 'b: BBB' -o output_folder/
Render from zip to zip: jj2c template.zip -V 'a: AAA' 'b: BBB' -o template.zip
Render to stdout: jj2c template-file -V 'a: AAA' 'b: BBB'
Or clone the repo:
$ git clone https://github.com/tly1980/jj2c.git $ python setup.py install
Using Jinja2 extendsions
Let say you have a use_do.tpl with following contents:
{%- set a = [] -%} {%- do a.append(1) -%} {%- do a.append(2) -%} {%- do a.append(name) -%} {{ a }}
In order to render those content properly you will need jinja2.ext.do extension.
Use -e or --extensions tags to specify the extensions. And you can specify more than one.
jj2c tests/fixtures/use_do.tpl -V 'name: jack' -e jinja2.ext.do jinja2.ext.i18n
Output is:
Using extensions: ['jinja2.ext.do', 'jinja2.ext.i18n'] Compiling... file to stdout src: tests/fixtures/use_do.tpl dest:- [1, 2, 'jack']
Contributing
TBD
Example
TBD
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
Built Distribution
File details
Details for the file jj2c-0.2.1.tar.gz
.
File metadata
- Download URL: jj2c-0.2.1.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1c4cc5a848510420fb86966180164e064a731a38be95be7ba75886371b7646a |
|
MD5 | 42e4e5fff8e6c9eb82f8dba4f091535f |
|
BLAKE2b-256 | 830f704f1abfaa1d30e4efae391c33383521774f1fa65d18d77cd6529d4ebaf2 |
File details
Details for the file jj2c-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: jj2c-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 314c895b1867653318efcf1083a46d4c72ff64058cc6eb8489c2686b98899cf0 |
|
MD5 | bc75f4989794b09c91e035e3acefe823 |
|
BLAKE2b-256 | 18bc7ac65b20d192fbe9009c44d99493cc26165447e0eb35405dfcceafdeb15c |