Skip to main content

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

This version

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ynj, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size ynj-0.1.0-py3-none-any.whl (15.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size ynj-0.1.0.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page