+
Skip to content

mooniak/litha

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Litha Almanac Generator

Generate a printable PDF almanac from structured JSON data using Jinja2 templates and WeasyPrint.

Requirements

  • Python 3.10 or newer
  • uv for managing the virtual environment and dependencies (preferred)
  • System packages required by WeasyPrint (e.g. libpango, cairo, gdk-pixbuf, and libffi). Refer to the WeasyPrint installation guide for your platform.

Installation

  1. Install uv (skip if you already have it):

    curl -LsSf https://astral.sh/uv/install.sh | sh

    After installation, ensure that uv is on your PATH (restart your shell if necessary).

  2. Install project dependencies:

    uv sync

    This command creates an isolated virtual environment (by default at .venv/) and installs the packages listed in pyproject.toml.

Usage

Generate the PDF almanac with:

uv run python main.py

The script reads data.json, renders the index.html template with Jinja2, applies style.css, and saves the resulting PDF as almanac.pdf in the project root.

Customizing the Almanac

  • Update data.json to change the content rendered into the template.
  • Modify index.html to adjust the HTML layout or include new data fields. The Jinja2 environment is configured with StrictUndefined, so missing values will cause a helpful error.
  • Edit style.css to tweak typography or layout in the final PDF.

Run uv run python main.py again after making changes to regenerate the PDF.

Troubleshooting

  • If uv reports missing system libraries during installation, install the required packages using your OS package manager and rerun uv sync.
  • For PDF rendering issues, check the console output for template or JSON errors and verify that all paths referenced in the template exist.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 79.6%
  • Python 10.8%
  • CSS 9.6%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载