jinja2loader
YamlLoader is a template loader for jinja2 template framework. It loads templates from yaml-files. Useful when you need to store many small templates in one file.
Install
pip install jinja2yaml
Usage:
# templates.yaml
home:
welcome: |
Welcome, {{username}}!
goodbye: |
Goodbye, {{username}}!
# main.py
from jinja2 import Environment
from jinja2yaml import YamlLoader
jinja = Environment(loader=YamlLoader('templates.yaml'))
username = 'John Doe'
template1 = jinja.get_template('home/welcome')
rendered1 = template1.render(username=username)
print(rendered1) # Welcome, John Doe!
template2 = jinja.get_template('home/goodbye')
rendered2 = template2.render(username=username)
print(rendered2) # Goodbye, John Doe!
Metadata
Release files for jinja2yaml 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jinja2yaml-0.1.5.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinja2yaml-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / jinja2yaml-0.1.5.tar.gz
| Download URL | jinja2yaml-0.1.5.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d0047524a19967c5d81054d092da0a4edae2208bfd881bab1dee551532d6833
|
|
BLAKE2b-256 checksum How to use checksums |
1d6f91dc9d063ab307db617a5e81678556e0002edf7fdca9be706217bc343d49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.12.4 CPython/3.12.2
|
Release files / jinja2yaml-0.1.5-py3-none-any.whl
| Download URL | jinja2yaml-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
269adea3d0c709099dedbc8fffe8f9e988896640dcc6a3282fb1782be3039963
|
|
BLAKE2b-256 checksum How to use checksums |
438b3139918991303d185c6177cb176feaf05f013f8f302623c1ca1dcba51d0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.12.4 CPython/3.12.2
|