YPE-1337: Add footnotes to the Bible book intro chapters#172
Conversation
This commit introduces support for rendering footnotes found in intro chapters (chapters without explicit verse numbers). Previously, footnotes were only processed if they were associated with a specific verse number. This change ensures that orphaned footnotes within introductory HTML are correctly identified, processed, and rendered as interactive footnote
Removes extraneous assertions from tests and cleans up internal
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
🦋 Changeset detectedLatest commit: 2189370 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryThis PR implements footnote support for Bible book intro chapters (e.g., The implementation uses a single-pass key assignment strategy where The Testing: 7 unit tests for the transform pipeline, 2 component tests for rendering behavior, and a Storybook integration test on the Code quality: The implementation is clean, well-documented, and follows existing patterns. The two-phase extraction approach (clone for data extraction, then mutate real DOM) is preserved. No breaking changes to the public API. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Raw Bible HTML with footnotes] --> B[wrapVerseContent]
B --> C{Has verse markers?}
C -->|Yes| D[Wrap in .yv-v span with v attribute]
C -->|No| E[Intro chapter - no wrapping]
D --> F[assignFootnoteKeys]
E --> F
F --> G{Footnote has .yv-v ancestor?}
G -->|Yes| H[Assign verse number as key]
G -->|No| I[Assign synthetic intro-N key]
H --> J[extractNotesFromWrappedHtml]
I --> J
J --> K[Group footnotes by key]
K --> L{Has verse wrapper?}
L -->|Yes| M[Build verseHtml + set hasVerseContext=true]
L -->|No| N[Set verseHtml='' + hasVerseContext=false]
M --> O[replaceFootnotesWithAnchors]
N --> O
O --> P[Create span with data-verse-footnote=key]
P --> Q[React Portal to VerseFootnoteButton]
Q --> R{hasVerseContext?}
R -->|Yes| S[Show verse reference + verse text + notes]
R -->|No| T[Show notes only - hide synthetic key]
Last reviewed commit: 19e5eb3 |
Amp-Thread-ID: https://ampcode.com/threads/T-019c95bd-a86f-738b-b59d-b3b9af08503d Co-authored-by: Amp <amp@ampcode.com>
|
@greptileai, please re-review. I've made some updates |
https://lifechurch.atlassian.net/browse/YPE-1337
Click to watch 1 min overview demo
GIF demo
Summary
Bible introduction chapters (e.g.
JOS.INTROin TPT) contain footnotes but have no verse markers. The existing footnote pipeline was entirely verse-keyed, so intro footnotes were silently skipped.You can see a footnote on a Bible book intro chapter when visiting https://www.bible.com/bible/1849/JOS.INTRO1
Changes
verse-html-utils.ts—extractNotesFromWrappedHtml()now collects orphaned footnotes and keys them as"intro-0","intro-1", etc.replaceFootnotesWithAnchors()uses matching synthetic keys instead of skipping.verse.tsx—VerseFootnoteButtonconditionally hides the verse reference label and verse text preview for intro footnotes.JoshuaIntroChapterstory.How to verify
pnpm test— all 561 tests passJoshuaIntroChapterstory → footnote icons appear inline, clicking shows popover with note content and no verse reference