Name | liquidpy JSON |
Version |
0.8.2
JSON |
| download |
home_page | https://github.com/pwwang/liquidpy |
Summary | A port of liquid template engine for python |
upload_time | 2024-01-11 23:54:16 |
maintainer | |
docs_url | None |
author | pwwang |
requires_python | >=3.7,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# liquidpy
A port of [liquid][19] template engine for python, on the shoulder of [jinja2][17]
[![Pypi][2]][9] [![Github][3]][10] [![PythonVers][4]][9] [![Docs building][13]][11] [![Travis building][5]][11] [![Codacy][6]][12] [![Codacy coverage][7]][12]
## Install
```shell
pip install -U liquidpy
```
## Playground
Powered by [pyscript][21]:
[https://pwwang.github.io/liquidpy/playground][22]
## Baisic usage
### Loading a template
```python
from liquid import Liquid
liq = Liquid('{{a}}', from_file=False)
ret = liq.render(a = 1)
# ret == '1'
# load template from a file
liq = Liquid('/path/to/template.html')
```
Using jinja's environment
```python
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('./'), ...)
liq = Liquid.from_env("/path/to/template.html", env)
```
### Switching to a different mode
```python
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'
```
### Changing default options
```python
from liquid import defaults, Liquid
defaults.FROM_FILE = False
defaults.MODE = 'wild'
# no need to pass from_file and mode anymore
liq = Liquid('{% from_ os import path %}{{path.basename("a/b.txt")}}')
liq.render()
# 'b.txt'
```
## Documentation
- [Liquidpy's documentation][8]
- [Liquid documentation (standard)][19]
- [Liquid documentation (jekyll)][18]
- [Liquid documentation (shopify-extended)][1]
- [Jinja2's documentation][20]
[1]: https://shopify.dev/api/liquid
[2]: https://img.shields.io/pypi/v/liquidpy.svg?style=flat-square
[3]: https://img.shields.io/github/tag/pwwang/liquidpy.svg?style=flat-square
[4]: https://img.shields.io/pypi/pyversions/liquidpy.svg?style=flat-square
[5]: https://img.shields.io/github/actions/workflow/status/pwwang/liquidpy/build.yml?style=flat-square
[6]: https://img.shields.io/codacy/grade/aed04c099cbe42dabda2b42bae557fa4?style=flat-square
[7]: https://img.shields.io/codacy/coverage/aed04c099cbe42dabda2b42bae557fa4?style=flat-square
[8]: https://pwwang.github.io/liquidpy
[9]: https://pypi.org/project/liquidpy/
[10]: https://github.com/pwwang/liquidpy
[11]: https://github.com/pwwang/liquidpy/actions
[12]: https://app.codacy.com/gh/pwwang/liquidpy/dashboard
[13]: https://img.shields.io/github/actions/workflow/status/pwwang/liquidpy/docs.yml?style=flat-square
[14]: https://github.com/pwwang/liquidpy/tree/lark
[15]: https://github.com/pwwang/liquidpy/tree/larkone
[16]: https://github.com/pwwang/liquidpy/issues/22
[17]: https://jinja.palletsprojects.com/
[18]: https://jekyllrb.com/docs/liquid/
[19]: https://shopify.github.io/liquid/
[20]: https://jinja.palletsprojects.com/
[21]: https://pyscript.net/
[22]: https://pwwang.github.io/liquidpy/playground
Raw data
{
"_id": null,
"home_page": "https://github.com/pwwang/liquidpy",
"name": "liquidpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "pwwang",
"author_email": "pwwang@pwwang.com",
"download_url": "https://files.pythonhosted.org/packages/ba/fc/a9b06b2df510555a73c6fc69d471ea0023be1725a30730d57b2157864dd8/liquidpy-0.8.2.tar.gz",
"platform": null,
"description": "# liquidpy\nA port of [liquid][19] template engine for python, on the shoulder of [jinja2][17]\n\n[![Pypi][2]][9] [![Github][3]][10] [![PythonVers][4]][9] [![Docs building][13]][11] [![Travis building][5]][11] [![Codacy][6]][12] [![Codacy coverage][7]][12]\n\n## Install\n```shell\npip install -U liquidpy\n```\n\n## Playground\n\nPowered by [pyscript][21]:\n\n[https://pwwang.github.io/liquidpy/playground][22]\n\n## Baisic usage\n\n### Loading a template\n```python\nfrom liquid import Liquid\nliq = Liquid('{{a}}', from_file=False)\nret = liq.render(a = 1)\n# ret == '1'\n\n# load template from a file\nliq = Liquid('/path/to/template.html')\n```\n\nUsing jinja's environment\n```python\nfrom jinja2 import Environment, FileSystemLoader\nenv = Environment(loader=FileSystemLoader('./'), ...)\n\nliq = Liquid.from_env(\"/path/to/template.html\", env)\n```\n\n### Switching to a different mode\n\n```python\nliq = Liquid(\n \"\"\"\n {% python %}\n from os import path\n filename = path.join(\"a\", \"b\")\n {% endpython %}\n {{filename}}\n \"\"\",\n mode=\"wild\" # supported: standard(default), jekyll, shopify, wild\n)\nliq.render()\n# 'a/b'\n```\n\n### Changing default options\n\n```python\nfrom liquid import defaults, Liquid\ndefaults.FROM_FILE = False\ndefaults.MODE = 'wild'\n\n# no need to pass from_file and mode anymore\nliq = Liquid('{% from_ os import path %}{{path.basename(\"a/b.txt\")}}')\nliq.render()\n# 'b.txt'\n```\n\n\n## Documentation\n\n- [Liquidpy's documentation][8]\n- [Liquid documentation (standard)][19]\n- [Liquid documentation (jekyll)][18]\n- [Liquid documentation (shopify-extended)][1]\n- [Jinja2's documentation][20]\n\n\n[1]: https://shopify.dev/api/liquid\n[2]: https://img.shields.io/pypi/v/liquidpy.svg?style=flat-square\n[3]: https://img.shields.io/github/tag/pwwang/liquidpy.svg?style=flat-square\n[4]: https://img.shields.io/pypi/pyversions/liquidpy.svg?style=flat-square\n[5]: https://img.shields.io/github/actions/workflow/status/pwwang/liquidpy/build.yml?style=flat-square\n[6]: https://img.shields.io/codacy/grade/aed04c099cbe42dabda2b42bae557fa4?style=flat-square\n[7]: https://img.shields.io/codacy/coverage/aed04c099cbe42dabda2b42bae557fa4?style=flat-square\n[8]: https://pwwang.github.io/liquidpy\n[9]: https://pypi.org/project/liquidpy/\n[10]: https://github.com/pwwang/liquidpy\n[11]: https://github.com/pwwang/liquidpy/actions\n[12]: https://app.codacy.com/gh/pwwang/liquidpy/dashboard\n[13]: https://img.shields.io/github/actions/workflow/status/pwwang/liquidpy/docs.yml?style=flat-square\n[14]: https://github.com/pwwang/liquidpy/tree/lark\n[15]: https://github.com/pwwang/liquidpy/tree/larkone\n[16]: https://github.com/pwwang/liquidpy/issues/22\n[17]: https://jinja.palletsprojects.com/\n[18]: https://jekyllrb.com/docs/liquid/\n[19]: https://shopify.github.io/liquid/\n[20]: https://jinja.palletsprojects.com/\n[21]: https://pyscript.net/\n[22]: https://pwwang.github.io/liquidpy/playground\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A port of liquid template engine for python",
"version": "0.8.2",
"project_urls": {
"Homepage": "https://github.com/pwwang/liquidpy",
"Repository": "https://github.com/pwwang/liquidpy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6849df5f810ecde8b1632ad2b08306935c16e821436a76e61f0f09b317190829",
"md5": "de4cb63a4c60adca00beebd6bd4e45d3",
"sha256": "641e090b63c2fd2c01b3046f9ae2d0dbfb2f388031d719e956c5d0cb2a5d2600"
},
"downloads": -1,
"filename": "liquidpy-0.8.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "de4cb63a4c60adca00beebd6bd4e45d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 32526,
"upload_time": "2024-01-11T23:54:14",
"upload_time_iso_8601": "2024-01-11T23:54:14.332410Z",
"url": "https://files.pythonhosted.org/packages/68/49/df5f810ecde8b1632ad2b08306935c16e821436a76e61f0f09b317190829/liquidpy-0.8.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bafca9b06b2df510555a73c6fc69d471ea0023be1725a30730d57b2157864dd8",
"md5": "7bc969dda78ce7a0c20ae81a2eb4f621",
"sha256": "ff7c1752bed93f4e2e90b35919b081e50ad290b82acbd4402c6fa37b2762a497"
},
"downloads": -1,
"filename": "liquidpy-0.8.2.tar.gz",
"has_sig": false,
"md5_digest": "7bc969dda78ce7a0c20ae81a2eb4f621",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 26781,
"upload_time": "2024-01-11T23:54:16",
"upload_time_iso_8601": "2024-01-11T23:54:16.046847Z",
"url": "https://files.pythonhosted.org/packages/ba/fc/a9b06b2df510555a73c6fc69d471ea0023be1725a30730d57b2157864dd8/liquidpy-0.8.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-11 23:54:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pwwang",
"github_project": "liquidpy",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "liquidpy"
}