Files
typikon/typikon/export/jsonout.py
T
funkpower 11bbfddbe1 the Orthodox liturgical day, computed rather than fetched
Feasts, seasons and the fast for twenty-three jurisdictions, derived from
the paschalion and the fixed calendar so it needs no network and cannot go
stale.

The three things calendar code usually conflates are kept apart: the
paschalion that gives Pascha, the menologion the fixed feasts are read on,
and the fasting rule that is kept. Almost every Orthodox Church keeps the
Julian Paschalion; what divides them is the menologion, so one file of
commemorations indexed by ecclesiastical date serves old and new calendars
alike.

Six fasting levels rather than three, because the difference between
xerophagy and wine-and-oil is the difference the books actually make. Level
and obligation are carried separately: the Orthodox rule reports everything
as customary, and Ruthenian particular law reports both how a day is kept
and the far smaller minimum that binds.

The menologion covers all 366 days and is dedicated to the public domain.
Sets published by someone else are fetched, never redistributed.
2026-09-18 09:09:32 -04:00

20 lines
681 B
Python

"""JSON, which is how every front end reads this.
The shape is flat and stable: front ends are the thing most likely to be
written by someone else, and a schema that shifts underneath them is a bad
neighbour. One day is an object; several are ``{"days": [...]}``.
"""
import json
__all__ = ["to_json"]
def to_json(days, indent=None):
if not isinstance(days, (list, tuple)):
return json.dumps(days.to_dict(), ensure_ascii=False, indent=indent)
if len(days) == 1:
return json.dumps(days[0].to_dict(), ensure_ascii=False, indent=indent)
return json.dumps({"days": [d.to_dict() for d in days]},
ensure_ascii=False, indent=indent)