Skip to content

Plugin for Jinjanator to allow XML-format data to be parsed and used in templates.

License

Notifications You must be signed in to change notification settings

kpfleming/jinjanator-plugin-format-toml

Repository files navigation

jinjanator-plugin-format-toml

Open Source Initiative Approved License logo CI Python License - Apache 2.0 Code Style - Black Types - Mypy Code Quality - Ruff Project Management - Hatch Testing - Pytest

This repo contains jinjanator-plugin-format-toml, a plugin which provides a TOML parser for the jinjanator tool.

Open Source software: Apache License 2.0

 

This plugin allows jinjanator to parse TOML data for processing in templates. The format can be selected using --format toml or autoselected by using a data file with a name ending with .toml.

Installation

pip install jinjanator-plugin-format-toml

Usage

Suppose you have an NGINX configuration file template, nginx.j2:

server {
  listen 80;
  server_name {{ nginx.hostname }};

  root {{ nginx.webroot }};
  index index.htm;
}

And you have a TOML file with the data, nginx.toml:

[nginx]
hostname="localhost"
webroot="/var/www/project"

This is how you render it into a working configuration file:

$ jinjanate nginx.j2 nginx.toml > nginx.conf

Options

This format does not support any options.

Chat

If you'd like to chat with the jinjanator community, join us on Matrix!

Credits

"Standing on the shoulders of giants" could not be more true than it is in the Python community; this project relies on many wonderful tools and libraries produced by the global open source software community, in addition to Python itself. I've listed many of them below, but if I've overlooked any please do not be offended :-)