Skip to content

Fix Preach My Gospel links and reference formats for 2023 edition#4

Merged
coderkearns merged 1 commit intomasterfrom
copilot/fix-preach-my-gospel-links
Mar 23, 2026
Merged

Fix Preach My Gospel links and reference formats for 2023 edition#4
coderkearns merged 1 commit intomasterfrom
copilot/fix-preach-my-gospel-links

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

PMG URLs were pointing to the old guide slug and using a flat chapter-N path scheme. The 2023 edition uses a new URL base with numbered path prefixes and nested sub-paths for Chapter 3's sections.

URL mapping (books.ts)

  • Replaced urlBase + chapterPrefix: 'chapter-' with a chapterMap lookup table on ScriptureBook
  • New base: preach-my-gospel-2023; each chapter key maps to its exact path segment (e.g. '3.3' → '04-chapter-3/08-chapter-3-lesson-1')

Reference format parsing (parser.ts)

  • Dropped page N / pg. N support entirely (was PMG-only anyway)
  • Replaced the old numberPrefix with a richer chapterPart alternation tried in specificity order:
    • Named sections: Message, Intro
    • Lesson shorthand: L1L4
    • Chapter 3 letter: 3B (invite page)
    • Chapter 3 decimal: 3.13.6
    • Any book: optional chapter / ch. / # prefix + digits

URL building (urlBuilder.ts)

Added normalizePmgSection() to canonicalize raw captures to chapterMap keys:

Input Key URL path
3 / 3.1 / chapter 3 3.1 04-chapter-3/06-chapter-3-intro
3B / 3.2 3.2 04-chapter-3/07-chapter-3-invite
L1 / 3.3 3.3 04-chapter-3/08-chapter-3-lesson-1
Message message 01-first-presidency-message

When chapterMap is present, buildUrl uses the map directly and skips verse anchors (PMG pages don't have paragraph-level anchors).

@coderkearns coderkearns marked this pull request as ready for review March 23, 2026 05:02
@coderkearns coderkearns merged commit d41f308 into master Mar 23, 2026
4 checks passed
@coderkearns coderkearns deleted the copilot/fix-preach-my-gospel-links branch March 23, 2026 05:02
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.

2 participants