Skip to main content

Simple templating engine

Project description

renderix

PyPI - Version

Simple templating engine.

renderix renders a template file by replacing placeholders with values loaded from a TOML file named renderix.toml in the current working directory.


Features

  • Tiny, no-dependency templating
  • Variables loaded from renderix.toml
  • Placeholders: [- name -]
  • For loops over arrays of tables
  • Conditionals (if / elif / else)
  • Output to stdout by default, or write to a file

Installation

uv tool install renderix

Or:

git clone https://codeberg.org/nietarne/renderix.git
cd renderix
uv tool install .

Quick start

  1. Create a renderix.toml in your working directory:
name = "John Doe"
  1. Create a template file, e.g. template.txt:
Hello [- name -]
  1. Render it to stdout:
renderix -t template.txt

Syntax

All tags use [- ... -] delimiters. Whitespace inside is flexible: [- name -] and [-name-] are both valid.

Variables

Hello, [- name -]!

For loops

# renderix.toml
[[employees]]
name = "John"
age = 40

[[employees]]
name = "Jane"
age = 42
[- for employee in employees -]
- [- employee.name -] is [- employee.age -] years old
[- endfor -]

Conditionals

[- if status == "active" -]
Active user
[- elif status == "pending" -]
Pending approval
[- else -]
Inactive
[- endif -]

Supported condition forms:

Form Example
Truthy/falsy check [- if user -]
Equality [- if status == "active" -]
Inequality [- if count != 0 -]
Comparison [- if score >= 10 -]

CLI options

  -t, --template    Template file to process (required)
  -o, --output      File to write output to (defaults to stdout)
  -v, --version     Print version and exit

Project details


Download files

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

Source Distribution

renderix-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

renderix-1.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file renderix-1.0.0.tar.gz.

File metadata

  • Download URL: renderix-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for renderix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5da83ea1b39b97bedc78a706a574d08414b0cd6a85a01e631354962fdd1a2645
MD5 81bc135f79d1d5b1b3bca053ed48db20
BLAKE2b-256 7a5cbbb71014fb0390593905fdc0f4b8ace5b491c0e1594163d9c847fd519e4c

See more details on using hashes here.

File details

Details for the file renderix-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: renderix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for renderix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc97c0e2be9045fb2611f8733f9458e550cbc4f596e7ea47e45bc1c9bc2f91b
MD5 68ffbbc6930b72dc825d6cdeafec6fb9
BLAKE2b-256 7cb3d69365adc1ad9719209f8898f707d9399d81cbd7d220caf61a38e69cf620

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page