Generic template language.
Project description
Templo
A generic template language.
Installation
Run the following command to install:
pip install templo
Usage
from templo import template
# Generate a render funtion
render = template("foo {{ 2 + 3 }} bar")
# returns 'foo 5 bar'
render()
# Generate a render function and pass a dictionary
d = {"name": "Diana"}
render = template("Hello, {{ name or 'World' }}!")
# returns 'Hello, World!'
render()
# returns 'Hello, Diana!'
render(d)
# Generate final text
# returns 'Hello, simple world!'
template("Hello,{% if answer == 42 %} simple {% else %} cruel {% endif %}world!", {'answer': 42})
# returns 'Hello, cruel world!'
template("Hello,{% if answer == 42 %} simple {% else %} cruel {% endif %}world!", {'answer': 73})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
templo-0.1.0.tar.gz
(22.9 kB
view hashes)
Built Distribution
templo-0.1.0-py3-none-any.whl
(27.9 kB
view hashes)