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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skabelon-1.1.0-py3-none-any.whl.
File metadata
- Download URL: skabelon-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61d425535f9e30d8e368321f843dffd7e1ee097fcddcdd48ecf468654dc8aa08
|
|
| MD5 |
99f36be9c9ae6ffbc5cf1bf345b846ac
|
|
| BLAKE2b-256 |
fa81d9def82fb0db1868569d5407fcfe7fd4874d3cdcae96d28fcd8587b4b662
|