diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-liquidpy.spec | 376 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 378 insertions, 0 deletions
@@ -0,0 +1 @@ +/liquidpy-0.8.0.tar.gz diff --git a/python-liquidpy.spec b/python-liquidpy.spec new file mode 100644 index 0000000..b2aff99 --- /dev/null +++ b/python-liquidpy.spec @@ -0,0 +1,376 @@ +%global _empty_manifest_terminate_build 0 +Name: python-liquidpy +Version: 0.8.0 +Release: 1 +Summary: A port of liquid template engine for python +License: MIT +URL: https://github.com/pwwang/liquidpy +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b4/2a/156f348fc1cfb16b49070ea236b0da89cb12c37dc61c90447c7874958f28/liquidpy-0.8.0.tar.gz +BuildArch: noarch + +Requires: python3-jinja2 +Requires: python3-frontmatter +Requires: python3-markdown +Requires: python3-regex +Requires: python3-slugify +Requires: python3-dateutil +Requires: python3-toml + +%description +# 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 + + +%package -n python3-liquidpy +Summary: A port of liquid template engine for python +Provides: python-liquidpy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-liquidpy +# 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 + + +%package help +Summary: Development documents and examples for liquidpy +Provides: python3-liquidpy-doc +%description help +# 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 + + +%prep +%autosetup -n liquidpy-0.8.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-liquidpy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.8.0-1 +- Package Spec generated @@ -0,0 +1 @@ +3e34e4106b53442d2d8031fe7da6ca8f liquidpy-0.8.0.tar.gz |
