Files
study-bible-project/src/utils/scriptDraft.js
T
nmemmertandClaude Sonnet 5.5 31abee0695
Build and Push Docker Image / build-and-push (push) Successful in 4m15s
Redesign the study side: Outline, Study, Script and Export stages
Studies now move through a stage bar in the reader's themes. Outline splits
chunks by clicking between verses (join merges notes) and suggests chunks from
section headings. Study is three panes: outline, passage with an Observe /
Interpret / Apply accordion, and commentary / word study / cross-refs / people
& places for the chunk; original words are added by clicking them in the
interlinear. Script drafts an outline from notes; Export holds files and the
share link. Home, Import and the Pronunciation guide are restyled. Study
projects are BSB only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-29 10:13:46 -04:00

30 lines
1.3 KiB
JavaScript

// Turns a chunk's study notes into a starting script outline for a talk or episode.
const has = (s) => (s ?? '').trim().length > 0;
export function buildScriptDraft(chunk, reference) {
const title = [chunk.episodeNumber, chunk.episodeTitle].filter(has).join(': ');
const words = (chunk.greekWords ?? [])
.filter((w) => w.lexeme || w.transliteration)
.map((w) => `• ${[w.lexeme, w.transliteration && `(${w.transliteration})`].filter(Boolean).join(' ')}${w.englishGloss || w.shortDefinition ? ` — ${w.englishGloss || w.shortDefinition}` : ''}`);
const section = (heading, body) => `${heading}\n${has(body) ? body.trim() : '[…]'}`;
return [
title || reference,
title ? reference : null,
'',
section('OPENING', ''),
'',
section('WHAT THE TEXT SAYS', chunk.observation),
'',
section('WHAT IT MEANS', chunk.interpretation),
...(words.length ? ['', 'KEY WORDS', ...words] : []),
'',
section('WHAT IT MEANS FOR US', chunk.application),
'',
section('CLOSING', ''),
].filter((line) => line !== null).join('\n');
}
export const wordCount = (s) => (s ?? '').trim().split(/\s+/).filter(Boolean).length;
// Speaking pace for the time estimate: about 150 words a minute.
export const spokenMinutes = (s) => Math.round((wordCount(s) / 150) * 10) / 10;