A port of liquid template engine for python
Project description
liquidpy
A port of liquid template engine for python
This is compatible with standard Liquid template engine. Variations, such as Shopify and Jekyll are not fully supported yet.
Install
pip install -U liquidpy
Baisic usage
from liquid import Liquid
liq = Liquid('{{a}}')
ret = liq.render(a=1)
# ret == '1'
# with environments pre-loaded
liq = Liquid('{{a}}', a=1)
ret = liq.render()
# ret == '1'
# With debug on:
liq = Liquid('{{a}}', liquid_config={'debug': True})
Python mode
We also support a python mode template engine, which acts more pythonic and powerful.
from liquid import Liquid
# standard liquid doesn't support this
liq = Liquid('{{a + 1}}', {'mode': 'python'})
ret = liq.render(a=1)
# ret == '2'
Both modes can accept a path, a file-like object or a stream for the template:
Liquid('/path/to/template')
# or
with open('/path/to/template') as f:
Liquid(f)
Full Documentation
- Liquid's documentation
- Liquidpy's documentation
Backward compatiblility warning
v0.6.0+
is a remodeled version to make it compatible with standard liquid engine. If you are using a previous version, stick with it. 0.6.0+
is not fully compatible with previous versions.
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
liquidpy-0.6.0.tar.gz
(43.3 kB
view hashes)
Built Distribution
liquidpy-0.6.0-py3-none-any.whl
(63.1 kB
view hashes)