Skip to main content

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


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)

Uploaded source

Built Distribution

templo-0.1.0-py3-none-any.whl (27.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page