Link the dates in commemoration stories to the day they fall on - #233
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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 Pythondate.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
gregorianlink would quietly switch an Old Calendar reader to the New Calendar. Reading the session makes the page sendVary: Cookie, the same as the readings index. A test asserts that header so the page can't later be cached across readers.Styling
#contentand got browser-default blue. On the saint page, solid accent red read like a rubric heading.#orthocal-contentso it outranks#content aon the saint page.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