Generate forensic report using docxtpl templates
Project description
laudo
Convert markdown files to docx or pdf using docxtpl templates and LibreOffice headless.
Installation
pip install laudo
Requires Python 3.13+ and LibreOffice installed system-wide for PDF output.
Usage
CLI
laudo <folder> <output>
<folder>— directory with your project files.<output>— output file (.docxor.pdf).
Python API
from laudo import convert
convert("my_project/", "output.docx")
convert("my_project/", "output.pdf")
Input Folder Structure
my_project/
├── template.docx # docxtpl template with Jinja2 placeholders
├── fotos/ # Images with captions (EXIF)
│ ├── logo.png
│ └── photo.jpg
├── context.txt # (optional) Variables one per line
├── intro.md # One or more .md files
└── chapter-1.md
template.docx
A standard Word document using docxtpl syntax. Use Jinja2 placeholders like {{ variable }} or {{p intro|markdown }}.
context.txt
Optional file with variables in key = value format, one per line:
author = John Doe
title = My Document
Lines starting with # and empty lines are ignored.
These variables are also available for substitution inside your .md files (see below).
Markdown files
Every .md file is read and its content is injected into the template context. The variable name is the filename without extension (whitespace replaced by underscores):
| File | Context key |
|---|---|
intro.md |
intro |
chapter 1.md |
chapter_1 |
You can use {{ varname }} inside .md files to reference values from context.txt:
context.txt:
name = John Doe
intro.md:
# Hello {{ name }}
The result will be # Hello John Doe, then stored in context key intro.
Use the subdoc global function to embed .docx files from the assets/ folder:
{{p subdoc("cover.docx") }}
Use the markdown filter in your template:
{{p intro|markdown }}
Fotos
All image files inside fotos/ are listed in the pics context variable:
{
"logo": {"path": "fotos/logo.png", "caption": "", "thumb": "fotos/.thumbs/logo_thumb.jpg", "reduced": "fotos/.thumbs/logo_reduced.jpg"},
"photo": {"path": "fotos/photo.jpg", "caption": "", "thumb": "fotos/.thumbs/photo_thumb.jpg", "reduced": "fotos/.thumbs/photo_reduced.jpg"}
}
Captions are read from EXIF ImageDescription metadata.
PDF Output
When the output path ends with .pdf, a docx is generated first and then converted to PDF via LibreOffice headless:
laudo my_project/ output.pdf
The intermediate docx file is automatically removed.
License
MIT
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 Distribution
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 laudo-0.1.0.tar.gz.
File metadata
- Download URL: laudo-0.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e03f85e6527d07d58238716b1ae3d2d00356a9b5a2f670dfdead9c1538bb291
|
|
| MD5 |
036f4214dcb3a9afed24d91dafb4d35e
|
|
| BLAKE2b-256 |
3b01c220829e75a9a062343d71fe309abf6b80841019a6b5fffabfef0c23c0ba
|
File details
Details for the file laudo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: laudo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d905a64eda90ee0996c82a8c25542cce623fac713f6d57f0d8a5f56a427a721c
|
|
| MD5 |
bd8c32173ff8d0fd02d2ca7e5d3df2f4
|
|
| BLAKE2b-256 |
29e5ecd03c86c150d0e108a9d8763bfc1fdd08595cdab84e1693fdb04fb321ba
|