liquidpy 0.8.2__tar.gz → 0.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {liquidpy-0.8.2 → liquidpy-0.8.4}/PKG-INFO +6 -4
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/__init__.py +1 -1
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/wild.py +28 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/pyproject.toml +7 -4
- {liquidpy-0.8.2 → liquidpy-0.8.4}/setup.py +9 -4
- {liquidpy-0.8.2 → liquidpy-0.8.4}/LICENSE +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/README.md +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/defaults.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/__init__.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/ext.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/filter_colon.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/front_matter.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/jekyll.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/shopify.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/standard.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/exts/wild.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/__init__.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/jekyll.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/manager.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/shopify.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/filters/standard.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/liquid.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/patching.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/__init__.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/jekyll.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/manager.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/shopify.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/standard.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/tags/wild.py +0 -0
- {liquidpy-0.8.2 → liquidpy-0.8.4}/liquid/utils.py +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: liquidpy
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
4
4
|
Summary: A port of liquid template engine for python
|
|
5
|
-
Home-page: https://github.com/pwwang/liquidpy
|
|
6
5
|
License: MIT
|
|
7
6
|
Author: pwwang
|
|
8
7
|
Author-email: pwwang@pwwang.com
|
|
@@ -15,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
18
|
Provides-Extra: extra
|
|
19
19
|
Requires-Dist: jinja2 (>=3,<4)
|
|
20
20
|
Requires-Dist: markdown (>=3.4,<4.0) ; (python_version < "3.8") and (extra == "extra")
|
|
@@ -22,8 +22,10 @@ Requires-Dist: markdown (>=3.5,<4.0) ; (python_version >= "3.8") and (extra == "
|
|
|
22
22
|
Requires-Dist: python-dateutil (>=2.8,<3.0) ; extra == "extra"
|
|
23
23
|
Requires-Dist: python-frontmatter (>=1.0,<2.0) ; extra == "extra"
|
|
24
24
|
Requires-Dist: python-slugify (>=8,<9) ; extra == "extra"
|
|
25
|
-
Requires-Dist: regex (>=2023.12,<2024.0) ; extra == "extra"
|
|
25
|
+
Requires-Dist: regex (>=2023.12,<2024.0) ; (python_version < "3.8") and (extra == "extra")
|
|
26
|
+
Requires-Dist: regex (>=2024.11,<2025.0) ; (python_version >= "3.8") and (extra == "extra")
|
|
26
27
|
Requires-Dist: toml (>=0.10,<0.11) ; extra == "extra"
|
|
28
|
+
Project-URL: Homepage, https://github.com/pwwang/liquidpy
|
|
27
29
|
Project-URL: Repository, https://github.com/pwwang/liquidpy
|
|
28
30
|
Description-Content-Type: text/markdown
|
|
29
31
|
|
|
@@ -86,3 +86,31 @@ def call(fn: Callable, *args, **kwargs) -> Any:
|
|
|
86
86
|
The result of calling the function
|
|
87
87
|
"""
|
|
88
88
|
return fn(*args, **kwargs)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@wild_filter_manager.register
|
|
92
|
+
def each(array: Any, fn: Callable, *args: Any, **kwargs: Any) -> Any:
|
|
93
|
+
"""Call a function for each item in an array.
|
|
94
|
+
|
|
95
|
+
With wild mode, you can use the 'map' filter to apply a function to each
|
|
96
|
+
item in an array. However, this filter is different from the 'map' filter
|
|
97
|
+
in that it takes the array as the first argument and additional arguments
|
|
98
|
+
passed to the function are allowed.
|
|
99
|
+
|
|
100
|
+
Examples:
|
|
101
|
+
>>> {{ floor | map: [1.1, 2.1, 3.1] | list }}
|
|
102
|
+
>>> # [1, 2, 3]
|
|
103
|
+
|
|
104
|
+
>>> {{ [1.1, 2.1, 3.1] | each: floor }}
|
|
105
|
+
>>> # [1, 2, 3]
|
|
106
|
+
>>> {{ [1.1, 2.1, 3.1] | each: plus, 1 }}
|
|
107
|
+
>>> # [2.2, 3.2, 4.2]
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
array: The array
|
|
111
|
+
fn: The callable
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
The result of calling the function for each item in the array
|
|
115
|
+
"""
|
|
116
|
+
return [fn(item, *args, **kwargs) for item in array]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = [ "poetry>=0.
|
|
2
|
+
requires = [ "poetry>=1.0.0",]
|
|
3
3
|
build-backend = "poetry.masonry.api"
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "liquidpy"
|
|
7
|
-
version = "0.8.
|
|
7
|
+
version = "0.8.4"
|
|
8
8
|
description = "A port of liquid template engine for python"
|
|
9
9
|
authors = [ "pwwang <pwwang@pwwang.com>",]
|
|
10
10
|
license = "MIT"
|
|
@@ -26,7 +26,10 @@ markdown = [
|
|
|
26
26
|
{version = "^3.4", optional = true, python = "<3.8"},
|
|
27
27
|
{version = "^3.5", optional = true, python = ">=3.8"},
|
|
28
28
|
]
|
|
29
|
-
regex =
|
|
29
|
+
regex = [
|
|
30
|
+
{version = "^2023.12", optional = true, python = "<3.8"},
|
|
31
|
+
{version = "^2024.11", optional = true, python = ">=3.8"},
|
|
32
|
+
]
|
|
30
33
|
python-slugify = {version = "^8", optional = true}
|
|
31
34
|
python-dateutil = {version = "^2.8", optional = true}
|
|
32
35
|
# needed by python-frontmatter
|
|
@@ -35,7 +38,7 @@ toml = {version = "^0.10", optional = true}
|
|
|
35
38
|
[tool.poetry.dev-dependencies]
|
|
36
39
|
pytest = "^7"
|
|
37
40
|
pytest-cov = "^4"
|
|
38
|
-
six = "^1.
|
|
41
|
+
six = "^1.17"
|
|
39
42
|
|
|
40
43
|
[tool.poetry.extras]
|
|
41
44
|
extra = ["python-frontmatter", "markdown", "regex", "python-slugify", "python-dateutil", "toml"]
|
|
@@ -12,16 +12,21 @@ install_requires = \
|
|
|
12
12
|
|
|
13
13
|
extras_require = \
|
|
14
14
|
{'extra': ['python-frontmatter>=1.0,<2.0',
|
|
15
|
-
'regex>=2023.12,<2024.0',
|
|
16
15
|
'python-slugify>=8,<9',
|
|
17
16
|
'python-dateutil>=2.8,<3.0',
|
|
18
17
|
'toml>=0.10,<0.11'],
|
|
19
|
-
'extra:python_version < "3.8"': ['markdown>=3.4,<4.0',
|
|
20
|
-
|
|
18
|
+
'extra:python_version < "3.8"': ['markdown>=3.4,<4.0',
|
|
19
|
+
'markdown>=3.4,<4.0',
|
|
20
|
+
'regex>=2023.12,<2024.0',
|
|
21
|
+
'regex>=2023.12,<2024.0'],
|
|
22
|
+
'extra:python_version >= "3.8"': ['markdown>=3.5,<4.0',
|
|
23
|
+
'markdown>=3.5,<4.0',
|
|
24
|
+
'regex>=2024.11,<2025.0',
|
|
25
|
+
'regex>=2024.11,<2025.0']}
|
|
21
26
|
|
|
22
27
|
setup_kwargs = {
|
|
23
28
|
'name': 'liquidpy',
|
|
24
|
-
'version': '0.8.
|
|
29
|
+
'version': '0.8.4',
|
|
25
30
|
'description': 'A port of liquid template engine for python',
|
|
26
31
|
'long_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',
|
|
27
32
|
'author': 'pwwang',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|