Skip to content

Link the dates in commemoration stories to the day they fall on - #233

Merged
brianglass merged 1 commit into
mainfrom
commemoration-date-links
Sep 14, 2026
Merged

brianglass merged 1 commit into
mainfrom
commemoration-date-links

Conversation

@brianglass

Copy link
Copy Markdown
Owner

Commemoration stories mention other commemorations by date — "a disciple of Saint Anthony (January 17)", "for his life, see December 20". About 340 such mentions exist across the story text. They're now links to that day's readings page, keeping the reader's tradition and calendar.

How it works

A template filter, link_commemoration_dates, rewrites only the text between tags when the story is rendered. The stored data is unchanged, so the API, the MCP tools and the Alexa speech still get plain text. It applies on the readings page and the saint pages.

Which dates link. About 300 of the mentions are cross-references, and those link. The filter leaves alone:

  • dates followed by a year ("January 2, 1833"), which are events in a life
  • date ranges ("21-22 November")
  • the two calendar-qualified dates ("March 5 OC, March 18 NC"). The app files that saint under the new-calendar date, so the OC date would go to a day he isn't on.
  • a reference to the day already being viewed

Which year. A date links within the current Church year, which starts September 1, so a page links the same way whenever it's read. Feb 29 is the exception and links to the soonest one that hasn't passed. On a saint page, which has no date of its own, "current" means today.

The Julian calendar. A story's "July 19" is a Church-calendar date, but the readings URL is a civil date. So for an Old Calendar reader it links to civil Aug 1. This adds datetools.julian_to_gregorian, which takes the Julian date as integers because a Julian Feb 29 in 2100 can't be a Python date.

The saint page follows the reader's remembered calendar. It can't use a fixed calendar: the readings page saves whatever calendar a URL carries, so a gregorian link would quietly switch an Old Calendar reader to the New Calendar. Reading the session makes the page send Vary: Cookie, the same as the readings index. A test asserts that header so the page can't later be cached across readers.

Styling

  • Before: on the readings page these links sat outside #content and got browser-default blue. On the saint page, solid accent red read like a rubric heading.
  • Now: the date keeps the paragraph's colour with a thin accent-red underline, taken from the nav's active-item style, and turns red on hover. Checked in light and dark mode.
  • The rule is scoped under #orthocal-content so it outranks #content a on the saint page.
  • Print: the links look exactly like the surrounding text, via a matching rule in print.css.

Testing

19 new tests cover the Church-year rule, Feb 29 in both calendars (including Julian 2100), the Julian conversion, each exclusion, markup safety, and both pages end to end. 216 tests pass. I also checked it in a running dev server: the Gregorian and Julian readings pages, the edge-case days, and the saint page as both a new visitor and an Old Calendar reader.

Deployment note

Nothing extra. Saint slugs are already backfilled in the Dockerfile, which is what the saint page needs.

🤖 Generated with Claude Code

https://claude.ai/code/session_019nQRjJpPqW89xqzAf1vsEX

Stories point at other commemorations by date -- "a disciple of Saint Anthony
(January 17)", "for his life, see December 20" -- and there are about 340 such
mentions across the story text. They are now links to that day's readings page,
keeping the reader's tradition and calendar.

The links are added at render time by a template filter, not written into the
data, so the API, the MCP tools and the Alexa speech still get plain text.

Which dates link. About 300 of the mentions are cross-references. Historical
dates are left alone: those followed by a year ("January 2, 1833"), date ranges
("21-22 November"), and the two calendar-qualified dates ("March 5 OC, March 18
NC") -- the app files that saint under the new-calendar date, so the OC date
would link to a day he isn't on. A reference to the day being viewed gets no
link.

Which year. A date links within the current Church year, which begins on
September 1, so a page links the same way whenever it is read. Feb 29 is the
exception and links to the soonest one that hasn't passed. On the saint page,
which has no date of its own, "current" means today.

The Julian calendar. A story's "July 19" is a Church-calendar date. For an Old
Calendar reader the readings URL is the civil date, so it links to civil Aug 1.
Adds datetools.julian_to_gregorian, which takes the Julian date as integers
because a Julian Feb 29 in 2100 can't be a Python date.

The saint page links on the calendar the reader last chose. It can't use a
fixed one: the readings page remembers whatever calendar a URL carries, so a
`gregorian` link would quietly switch an Old Calendar reader to the New. Reading
the session makes the page send Vary: Cookie, the same as the readings index,
and a test asserts it so the page can't later be cached across readers.

Styling. On the readings page these links sat outside #content and were getting
browser-default blue; on the saint page a solid accent-red link read like a
rubric heading. They now keep the paragraph's colour with a thin accent-red
underline, borrowed from the nav's active-item treatment, turning red on hover.
Checked in light and dark mode. Scoped under #orthocal-content so it outranks
`#content a` on the saint page. In print they look exactly like the surrounding
text, via a matching rule in print.css.

19 new tests. 216 pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019nQRjJpPqW89xqzAf1vsEX
@brianglass
brianglass merged commit 2427428 into main Sep 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant