Files
study-bible-project/src/utils/passageSummary.js
T
nmemmertandClaude Sonnet 5.5 d13f55faf7 Add Outline stage, parallel reading, offline saves, backup, sync-conflict handling and more
Study
- New Outline stage (hierarchical I./A./1. points, linked to chunks, in all exports);
  the chunk stage is now "Chunks"
- Home cards: passages shown as ranges, tags capped with "+N more"

Reader
- Side-by-side translations and a Compare tab per verse
- Typeface, line spacing, verse-number settings; text and column scale with the screen
- Highlights/bookmarks sheet with named colours (synced); BSB footnote spacing fix
- Cmd-K palette (passages, studies, notes, marks), keyboard shortcuts and "?" help

Flow and safety
- Toasts with Undo replace most confirm()/alert()
- Back/Forward move between pages
- Server refuses saves over a newer copy (409); keep-mine / use-other banner;
  opening a study no longer re-stamps it
- Latest chapter request wins when flipping quickly

Offline and data
- Save books, plan days or a whole BSB/NET for offline
- Service worker fixes: helloao /api/ URLs were skipped and responses cloned too late
- Settings: download/restore a full backup

Accessibility
- Sheets trap focus and close on Escape, skip link, focus ring, reduced motion,
  theme contrast raised to 4.5:1 (with a test)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-01 14:08:08 -04:00

24 lines
1000 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// "Luke 1, Luke 2, Luke 3, Luke 5" -> "Luke 1–3, 5": a long run of chapters reads as ranges, so a
// study card stays short. Anything that isn't "Book N" is left as it was.
export function compactPassages(summary) {
if (!summary) return '';
const parts = summary.split(/,\s*/);
const groups = [];
for (const part of parts) {
const m = part.match(/^(.+?)\s+(\d+)$/);
if (!m) { groups.push({ raw: part }); continue; }
const last = groups[groups.length - 1];
if (last && last.book === m[1]) last.chapters.push(Number(m[2]));
else groups.push({ book: m[1], chapters: [Number(m[2])] });
}
return groups.map((g) => {
if (g.raw !== undefined) return g.raw;
const runs = [];
for (const n of g.chapters) {
const run = runs[runs.length - 1];
if (run && n === run[1] + 1) run[1] = n; else runs.push([n, n]);
}
return `${g.book} ${runs.map(([a, b]) => (a === b ? a : b === a + 1 ? `${a}, ${b}` : `${a}–${b}`)).join(', ')}`;
}).join(', ');
}