- Notifications
You must be signed in to change notification settings - Fork9
A port of liquid template engine for python
License
NotificationsYou must be signed in to change notification settings
pwwang/liquidpy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A port ofliquid template engine for python, on the shoulder ofjinja2
pip install -U liquidpy
Powered bypyscript:
https://pwwang.github.io/liquidpy/playground
fromliquidimportLiquidliq=Liquid('{{a}}',from_file=False)ret=liq.render(a=1)# ret == '1'# load template from a fileliq=Liquid('/path/to/template.html')
Using jinja's environment
fromjinja2importEnvironment,FileSystemLoaderenv=Environment(loader=FileSystemLoader('./'), ...)liq=Liquid.from_env("/path/to/template.html",env)
liq=Liquid(""" {% python %} from os import path filename = path.join("a", "b") {% endpython %} {{filename}} """,mode="wild"# supported: standard(default), jekyll, shopify, wild)liq.render()# 'a/b'
fromliquidimportdefaults,Liquiddefaults.FROM_FILE=Falsedefaults.MODE='wild'# no need to pass from_file and mode anymoreliq=Liquid('{% from_ os import path %}{{path.basename("a/b.txt")}}')liq.render()# 'b.txt'
About
A port of liquid template engine for python
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Contributors3
Uh oh!
There was an error while loading.Please reload this page.