Simple file template renderer
Project description
stemplates
Render files with embedded python code. Executes exec
and substitutes
expression with the result.
Usage
from stemplates import render_template
# Simple substitution
text = "Hello, {% username %}"
rendered = render_template(text, username="John")
# Conditionals
text = "Hello, {% f'{name} {lastname}' if full_name else name %}"
rendered = render_template(text, name="John", lastname="Green", full_name=False)
# Render files
render_file_to("some.template", "out.txt", param1="Param", param2="...")
Install
pip install stemplates
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
stemplates-1.0.1.tar.gz
(4.0 kB
view hashes)