diff --git a/src/App.jsx b/src/App.jsx index 21b83f6..ae51afa 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -129,7 +129,10 @@ export function migrateChunk(chunk) { function chunkSpansNextChapter(project, startChapterIndex, chunk) { if (!project || !Array.isArray(project.chapters)) return false; if (!Number.isInteger(chunk?.spilloverEndVerse)) return false; - return startChapterIndex >= 0 && startChapterIndex < project.chapters.length - 1; + if (startChapterIndex < 0 || startChapterIndex >= project.chapters.length - 1) return false; + const startChapter = project.chapters[startChapterIndex]; + const nextChapter = project.chapters[startChapterIndex + 1]; + return startChapter?.bookAbbrev && startChapter.bookAbbrev === nextChapter?.bookAbbrev; } function formatChunkReference(project, startChapterIndex, chunk, separator = '-') { @@ -323,15 +326,12 @@ export function buildExportHtml(project) { const chapters = Array.isArray(project.chapters) ? project.chapters : []; - const chunksHtml = chapters.map((ch) => { + const chunksHtml = chapters.map((ch, chapterIndex) => { const chapterHeader = `
${verse.number} ${verse.text}
`) + const scripture = formatChunkReference(project, chapterIndex, chunk, '-'); + const versesText = getChunkVerseEntries(project, chapterIndex, chunk) + .map((verse) => `${verse.chapter}:${verse.number} ${verse.text}
`) .join(''); const observation = (chunk.observation ?? '').trim().replace(/\n/g, '