https://github.com/kpfleming/jinjanator-plugin-format-toml
Plugin for Jinjanator to allow XML-format data to be parsed and used in templates.
https://github.com/kpfleming/jinjanator-plugin-format-toml
jinja2 jinja2-cli python python3 toml
Last synced: 5 months ago
JSON representation
Plugin for Jinjanator to allow XML-format data to be parsed and used in templates.
- Host: GitHub
- URL: https://github.com/kpfleming/jinjanator-plugin-format-toml
- Owner: kpfleming
- License: apache-2.0
- Created: 2023-08-03T14:58:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-15T12:06:46.000Z (6 months ago)
- Last Synced: 2025-12-18T13:32:51.968Z (6 months ago)
- Topics: jinja2, jinja2-cli, python, python3, toml
- Language: Shell
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# jinjanator-plugin-format-toml
[](https://github.com/kpfleming/jinjanator-plugin-format-toml/actions/workflows/ci.yml)
[](https://www.python.org/downloads/release/python-31019/)
[](https://spdx.org/licenses/Apache-2.0.html)
[](https://github.com/psf/black)
[](https://github.com/python/mypy)
[](https://github.com/astral-sh/ruff)
[](https://github.com/pypa/hatch)
[](https://github.com/pytest-dev/pytest)
This repo contains `jinjanator-plugin-format-toml`, a plugin which
provides a TOML parser for the
[jinjanator](https://github.com/kpfleming/jinjanator) tool.
Open Source software: [Apache License 2.0](https://spdx.org/licenses/Apache-2.0.html)
##
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`:
```jinja2
server {
listen 80;
server_name {{ nginx.hostname }};
root {{ nginx.webroot }};
index index.htm;
}
```
And you have a TOML file with the data, `nginx.toml`:
```toml
[nginx]
hostname="localhost"
webroot="/var/www/project"
```
This is how you render it into a working configuration file:
```bash
$ 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](https://matrix.to/#/#jinjanator:km6g.us)!
## Credits
["Standing on the shoulders of
giants"](https://en.wikipedia.org/wiki/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 :-)
* [Black](https://pypi.org/project/black)
* [Hatch-Fancy-PyPI-Readme](https://pypi.org/project/hatch-fancy-pypi-readme)
* [Hatch](https://pypi.org/project/hatch)
* [Mypy](https://pypi.org/project/mypy)
* [pyproject-fmt](https://pypi.org/project/pyproject-fmt)
* [Pytest](https://pypi.org/project/pytest)
* [Ruff](https://pypi.org/project/ruff)
* [Towncrier](https://pypi.org/project/towncrier)