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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
templo-0.1.0-py3-none-any.whl
(27.9 kB
view details)
File details
Details for the file templo-0.1.0.tar.gz.
File metadata
- Download URL: templo-0.1.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d82799a1b2bef6e12a7b4239c868814bd5eed1cd229da574eacbb80dc11c2f35
|
|
| MD5 |
cdc187f5f972d3cadefe4a3b413efe03
|
|
| BLAKE2b-256 |
c95af41f0f2e3d64da3ad47a9c11791d5ee95ee502aaa9b92b0d84c8838077cc
|
File details
Details for the file templo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: templo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b69f40124fb336a5133b261f894ed7a43bd1a665910a6fb1b75fb709a654e086
|
|
| MD5 |
98f8cd4ca7e373cb73bdad3378e7f9c0
|
|
| BLAKE2b-256 |
8a300d0a1cdbca3706e5e4b35db23178b6a15cacbec9cfb09dac7f8f50a56a7c
|