Compile Jinja templates with YAML variables
Project description
ynj
Compile Jinja templates using YAML variables!
Installation
pip install ynj
Usage
To use ynj you need yaml file with the variables, and a jinja template.
An example values.yml file:
---
name: John
surname: Collins
jobs:
- name: "Python developer"
technologies: [Pyton, SQL]
- name: "Database administrator"
technologies: [PostgreSQL, Oracle]
A sample template:
<h1>{{ name }} {{ surname }}</h2>
<dl>
{% for job in jobs %}
<dt>{{ job.name }}</dt>
<dd>{{ ', '.join(job.technologies) }}</dd>
{% endfor %}
</dl>
To fill the values into the template, run:
ynj < jobs.j2
You can override values also from command line:
ynj -t jobs.j2 -s "{name: Matt}"
More info: ynj -h.
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
ynj-1.1.0.tar.gz
(2.9 kB
view details)
File details
Details for the file ynj-1.1.0.tar.gz.
File metadata
- Download URL: ynj-1.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5bbbaae8f941f54abbf892c5d609ae0b769d130f418291d5ef832ea99b51320
|
|
| MD5 |
5847432353e20f85c50dfc8e0be2868c
|
|
| BLAKE2b-256 |
158021030ac273a897a30aaad4aafb54346681b6f4d2129b73f3875fe7ca7489
|