Family Tree Calendar

Turn the output of Gramps' Web Calendar report into clean, styled, mobile-friendly birthday and anniversary calendar pages for a family website.

The tool reads the plain HTML that Gramps' Web Calendar report writes to cal/<year>/1.html … 12.html and rewrites those twelve pages in a consistent house style — one page per month, with a month navigation bar, a year switcher, and historical events tucked behind a per-day toggle.

The language of the finished calendar is controlled by the script. English and Danish can be auto-detected from the Gramps export. Additional languages can be used by adding a language pack and selecting it explicitly with --sprog.


Why this exists

My own calendar gets its data from the full web-based version of the family tree. That report is relatively heavy to generate when the only purpose is to update the calendar, and some users may not have a full web family tree at all.

Gramps' lighter Web Calendar report provides the same day-by-day calendar data, so this tool uses that report instead. A full family-site rebuild is not necessary.

The two Gramps reports differ in a few details, including cell IDs, monthly file names, and whether person links are present. This tool is written specifically for Web Calendar output generated with Link to Narrative Web turned off.


Requirements


Tested platforms

Tested with:


Included files

The release package contains:


Input: generating the source in Gramps

In Gramps, run:

Reports → Web Pages → Web Calendar

Use these settings:

Gramps writes the result to:

…/cal/<year>/1.html … 12.html


Usage

Extract the release ZIP into the folder that contains the cal folder.

For the normal case, no arguments are needed:

python webcal_kalender.py

The script then:

The generated calendar can be opened locally in a web browser.

Options

Option Meaning
--sti PATH Folder that contains cal/ (default: current folder).
--aar YEAR Base year = this year + next year (default: current year). Set it if Gramps' start year is not the current year.
--sprog CODE Select a language code, e.g. da, en, or de. English and Danish can be auto-detected from <html lang>; other languages must be selected manually.
--ud FOLDER Write the styled pages to FOLDER/<year> instead of rewriting them in place.
--json Also write kalender_data.json for each year (for debugging).
--no-index Do not write index_kalender.html (it is written by default).
--dump-sprog Write the built-in language packs to sprog/*.json as templates, then exit.

Output

For each built year, the script writes the following files to cal/<year>/ (or to the folder selected with --ud):

It also writes one file in the site root (--sti):

What a day shows

Icon Event Info line
🎂 Birthday (living) age, e.g. 72 years
🕯️ Birthday (deceased) † <death date>
Anniversary of a death † <year of death>
💍 Wedding anniversary e.g. 59 year anniversary or married 62 years (until 1995)

Living birthdays are shown directly on the day.

Historical events, such as deceased birthdays, deaths, and anniversaries, are collapsed behind a small +N ⭣ toggle so the calendar grid stays readable. They expand when the toggle is clicked.


Language

The script has built-in calendar language support for English (en) and Danish (da).

Adding a language

Place a sprog/<code>.json file next to the script. No code change is needed.

For example:

python webcal_kalender.py --dump-sprog cp sprog/en.json sprog/de.json # Translate the values in de.json python webcal_kalender.py --sprog de

--dump-sprog writes the built-in English and Danish language packs as templates.

A language pack may be partial. Any missing key falls back to English.

The available keys are:

months, weekdays, title, page_title, years, legend_alive, legend_dead, legend_death, legend_wedding, legend_hint, toggle_title, wed_anniv, wed_married, wed_until, wed_word, couple_join, html_lang.

A German starter pack, de.json, is included as an example.

The event wording is rebuilt from numerical information in the source, such as ages, years married, and year of death. This allows that wording to follow the calendar's selected language.

Source dates still come from the Gramps export, so the source language and date format can matter when adding another language. For example, English Gramps writes ISO-style dates such as 2016-10-05, which are language-neutral and therefore convenient when building a third language from an English source.


Notes and gotchas


Support

For questions and troubleshooting, see:

https://myown-project.dk/support/index.html


License

Released under the GNU General Public License v2.0 or later (GPL-2.0-or-later), the same license as Gramps.


Author

Henning — contact@myown-project.dk
https://myown-project.dk