Metadata-Version: 2.4
Name: larztemplate
Version: 0.1.0
Summary: A tiny template engine - variables, loops and branches, render HTML, zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larztemplate
Project-URL: Repository, https://github.com/larz-scripter/larztemplate
Project-URL: Issues, https://github.com/larz-scripter/larztemplate/issues
Keywords: template,templating,html,rendering,learn-to-code,building-blocks,parser,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larztemplate

**A tiny template engine — fill placeholders, loop and branch, render HTML.**

Every real app builds strings from data: web pages, emails, config files. Rather
than messy string concatenation, you use a template. larztemplate is a small but
genuine template engine — `{{ variables }}`, `{% for %}` loops and `{% if %}`
branches — so you can generate HTML and text cleanly, and understand how
templating actually works. Zero dependencies.

## Install

```bash
pip install larztemplate
```

## Use

```python
from larztemplate import render

render("Hello, {{ name }}!", {"name": "Ada"})
render("{% for x in items %}{{ x }} {% endfor %}", {"items": [1, 2, 3]})
render("{% if admin %}welcome boss{% else %}hi{% endif %}", {"admin": True})
render("<p>{{ msg }}</p>", {"msg": "<b>hi</b>"}, escape=True)   # escapes the value
```

## Learn to code with Larz

Part of the **learn-to-code toolkit** in the [Larz stack](https://github.com/larz-scripter) —
see the [Learn to Code platform](https://larzos.com/learn/). A building block for
real apps, and a readable example of parsing and rendering.

## Tests

```bash
python -m unittest discover -s tests -v   # 9 tests
```

## License

MIT (c) larz-scripter
