Files
study-bible-project/src/utils/outlineLabels.js
T
nmemmertandClaude Sonnet 5.5 820886e3ab Outline: per-chunk outlines, richer points, print and share
- One outline for the whole study plus one per chunk (picker at the top);
  chunk outlines can start from the chunk's verses, each carrying its words
- Points can have a type (illustration, application, quote, question,
  transition), minutes (with a running total), a longer note, verse text
  fetched from a passage, and cross-references / word studies attached from
  the chunk
- Share (system share sheet, or copy), Print / PDF, Copy as text, Word and
  Markdown downloads for any one outline
- All of it included in the Markdown, HTML/PDF and Word study exports,
  with each chunk's outline under that chunk

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

35 lines
1.2 KiB
JavaScript

// How outline points are numbered. Kept free of imports so both the page and the exporters can use it.
const ROMAN = [[10, 'X'], [9, 'IX'], [5, 'V'], [4, 'IV'], [1, 'I']];
export function toRoman(n) {
let out = '';
let rest = n;
for (const [value, symbol] of ROMAN) while (rest >= value) { out += symbol; rest -= value; }
return out;
}
const letter = (n, upper) => {
let out = '';
let rest = n;
while (rest > 0) { rest -= 1; out = String.fromCharCode((upper ? 65 : 97) + (rest % 26)) + out; rest = Math.floor(rest / 26); }
return out;
};
// I. / A. / 1. / a. / (1) / (a), by level
export function labelFor(depth, index) {
const n = index + 1;
switch (depth) {
case 0: return `${toRoman(n)}.`;
case 1: return `${letter(n, true)}.`;
case 2: return `${n}.`;
case 3: return `${letter(n, false)}.`;
case 4: return `(${n})`;
default: return `(${letter(n, false)})`;
}
}
export const KINDS = [
['', 'Point'], ['illustration', 'Illustration'], ['application', 'Application'],
['quote', 'Quote'], ['question', 'Question'], ['transition', 'Transition'],
];
export const kindLabel = (kind) => KINDS.find(([id]) => id === kind)?.[1] ?? '';