From 9388de679ff9cc4c1bbeeceef99799c34a7ddf7b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 26 Nov 2025 15:10:07 -0500 Subject: [PATCH] Add support for cross-book chapter references without verses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle patterns like "Hebrews 5-7" (chapter range) and "Hebrews 11" (single chapter) that don't include verse numbers (no colon). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kjvstudy_org/templates/book.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kjvstudy_org/templates/book.html b/kjvstudy_org/templates/book.html index c5ed66b..81c00bb 100644 --- a/kjvstudy_org/templates/book.html +++ b/kjvstudy_org/templates/book.html @@ -252,13 +252,29 @@ document.addEventListener('DOMContentLoaded', function() { return match; }); - // Match standalone cross-book references outside parentheses + // Match standalone cross-book verse references outside parentheses (with colon) const standaloneCrossBookRegex = new RegExp('(' + bookPattern + ')\\s+(\\d+):(\\d+)(?:-(\\d+))?', 'gi'); text = text.replace(standaloneCrossBookRegex, function(match, book, chapter, verseStart, verseEnd) { changed = true; return createVerseLink(book, chapter, verseStart, verseEnd, match); }); + // Match cross-book chapter ranges like "Hebrews 5-7" (no colon = chapters, not verses) + const crossBookChapterRangeRegex = new RegExp('(' + bookPattern + ')\\s+(\\d+)-(\\d+)(?!:)', 'gi'); + text = text.replace(crossBookChapterRangeRegex, function(match, book, chapterStart, chapterEnd) { + changed = true; + const normalizedBook = book.replace(/\s+/g, ' '); + return '' + match + ''; + }); + + // Match cross-book single chapter like "Hebrews 11" (no colon) + const crossBookChapterRegex = new RegExp('(' + bookPattern + ')\\s+(\\d+)(?![:\\d-])', 'gi'); + text = text.replace(crossBookChapterRegex, function(match, book, chapter) { + changed = true; + const normalizedBook = book.replace(/\s+/g, ' '); + return '' + match + ''; + }); + // Match remaining standalone verse ranges like "1:1-5" not in parentheses text = text.replace(/(?\d])(\d+):(\d+)-(\d+)(?![<\d])/g, function(match, chapter, verseStart, verseEnd) { changed = true;