Skip to main content

Create complex document templates using Jinja2

Project description

skabelon

Skabelon ([sɡ̊ɑb̥əˈloːˀn]), from the Danish word for "template", is a python package to create complex document templates. It wraps the Jinja2 library and enriches its default filters with sensible options for converting Python types to Markdown and LaTeX (e.g. for lists and tables).

Usage

Filters

Filters (i.e. Jinja2 functions) can be called like any filter within a Jinja2 template, and are designed to be used directly with corresponding Python types.

Example: *_list

For example, both latex_list and markdown_list accept a list of strings (or any other type that can be represented as a string) and transform them into appropriate templated strings during rendering.

Assume that our Python list looks like this: foo = ["foo", "bar", "baz"]. In a Markdown Jinja2 template, applying the filter could like this:

# My rendered list

This example renders a markdown list:

{{ foo | markdown_list }}

Which would result in the following rendered output:

# My rendered list

This example renders a markdown list:

- foo
- bar
- baz

For LaTeX templates, the template and outlook would look like this:

\section{My rendered list}

This example renders a \LaTeX list:

{{ foo | latex_list }}

Which accordingly would result in the following rendered output:

\section{My rendered list}

This example renders a \LaTeX list:

\begin{itemize}
\item foo
\item bar
\item baz
\end{itemize}

Both rendered outputs could then be processed further with their respective toolchains, e.g. a Markdown renderer, or a LaTeX toolchain matching the overall templated contents (e.g., LuaLaTeX).

Development

This project is written in python3. It uses pipenv for dependency management, pytest for testing, and black for formatting.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

skabelon-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: skabelon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for skabelon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4523752950516ea5106cb1bbb333faf7b5993445ce97ab1ad63fddb4938aff
MD5 3d0b1ff44f0b7e968ba15d4357f7a4e6
BLAKE2b-256 8b60073051c72950ace75234e0fad17d8e69936f7b81385fcbecabfb33e97220

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