All Projects → pwwang → liquidpy

pwwang / liquidpy

Licence: Apache-2.0 license
A port of liquid template engine for python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to liquidpy

dry
Dry is a new template engine and language, and is a superset of Shopify's Liquid, with first-class support for advanced inheritance features, and more. From the creators of Enquirer, Assemble, Remarkable, and Micromatch.
Stars: ✭ 66 (+34.69%)
Mutual labels:  template-engine, liquid, shopify, liquid-templating-engine
liquid
A Python engine for the Liquid template language.
Stars: ✭ 40 (-18.37%)
Mutual labels:  template-engine, liquid, liquid-templating-engine
mechanic-tasks
Public task repository for Mechanic (https://mechanic.dev)
Stars: ✭ 42 (-14.29%)
Mutual labels:  liquid, shopify, liquid-templating-engine
gulp-shopify-theme
Shopify theme synchronisation during development
Stars: ✭ 26 (-46.94%)
Mutual labels:  liquid, shopify, liquid-templating-engine
Jingoo
OCaml template engine almost compatible with jinja2
Stars: ✭ 86 (+75.51%)
Mutual labels:  template-engine, jinja2
Solid
Liquid template engine in Elixir
Stars: ✭ 68 (+38.78%)
Mutual labels:  template-engine, liquid
Tera
A template engine for Rust based on Jinja2/Django
Stars: ✭ 1,873 (+3722.45%)
Mutual labels:  template-engine, jinja2
liquid.cr
Kind of liquid template engine for Crystal [WIP]
Stars: ✭ 64 (+30.61%)
Mutual labels:  template-engine, liquid
Cookie
A Template-based File Generator. Like cookiecutter but works with file templates instead of project templates.
Stars: ✭ 261 (+432.65%)
Mutual labels:  template-engine, jinja2
jinja.dart
Jinja2 template engine port for Dart.
Stars: ✭ 38 (-22.45%)
Mutual labels:  template-engine, jinja2
LiquidKit
Liquid template language parser engine in Swift.
Stars: ✭ 19 (-61.22%)
Mutual labels:  template-engine, liquid-templating-engine
Jinja
A very fast and expressive template engine.
Stars: ✭ 8,170 (+16573.47%)
Mutual labels:  template-engine, jinja2
Redzone
Lightweight C++ template engine with Jinja2-like syntax
Stars: ✭ 30 (-38.78%)
Mutual labels:  template-engine, jinja2
Liquidjs
A simple, expressive, safe and Shopify compatible template engine in pure JavaScript.
Stars: ✭ 638 (+1202.04%)
Mutual labels:  template-engine, liquid
shopify-wishlist
💙 A set of files used to implement a simple customer wishlist on a Shopify store
Stars: ✭ 115 (+134.69%)
Mutual labels:  liquid, shopify
templatel
Jinja inspired template language for Emacs Lisp
Stars: ✭ 46 (-6.12%)
Mutual labels:  template-engine, jinja2
bootstrap-shopify-theme
🛍 A free Shopify Theme built with Bootstrap, BEM, Liquid, Sass, ESNext, Theme Tools, ... and Webpack.
Stars: ✭ 41 (-16.33%)
Mutual labels:  liquid, shopify
korte
Kotlin cORoutines Template Engine for Multiplatform Kotlin
Stars: ✭ 69 (+40.82%)
Mutual labels:  template-engine, liquid
Jinja2cpp
Jinja2 C++ (and for C++) almost full-conformance template engine implementation
Stars: ✭ 257 (+424.49%)
Mutual labels:  template-engine, jinja2
vscode-liquid
💧Liquid language support for VS Code
Stars: ✭ 137 (+179.59%)
Mutual labels:  liquid, shopify

liquidpy

A port of liquid template engine for python, on the shoulder of jinja2

Pypi Github PythonVers Docs building Travis building Codacy Codacy coverage

Install

pip install -U liquidpy

Playground

Powered by pyscript:

https://pwwang.github.io/liquidpy/playground

Baisic usage

Loading a template

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

from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('./'), ...)

liq = Liquid.from_env("/path/to/template.html", env)

Switching to a different mode

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

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].