add Douay-Rheims Bible to the project for english bible references
All checks were successful
CI / update (push) Successful in 19s

This commit is contained in:
2026-02-11 10:15:54 +01:00
parent 35ea60e637
commit 01ccc705ee
7 changed files with 36472 additions and 40 deletions

View File

@@ -5,48 +5,61 @@
import { writeFileSync } from 'fs';
import { resolve } from 'path';
import { lookupReference } from '../src/lib/server/bible';
import { mysteryReferences } from '../src/lib/data/mysteryDescriptions';
import { mysteryReferences, mysteryReferencesEnglish } from '../src/lib/data/mysteryDescriptions';
import type { MysteryDescription, VerseData } from '../src/lib/data/mysteryDescriptions';
const tsvPath = resolve('static/allioli.tsv');
function generateVerseData(
references: Record<string, readonly { title: string; reference: string }[]>,
tsvPath: string
): Record<string, MysteryDescription[]> {
const result: Record<string, MysteryDescription[]> = {};
const mysteryDescriptions: Record<string, MysteryDescription[]> = {};
for (const [mysteryType, refs] of Object.entries(references)) {
const descriptions: MysteryDescription[] = [];
for (const [mysteryType, references] of Object.entries(mysteryReferences)) {
const descriptions: MysteryDescription[] = [];
for (const ref of refs) {
const lookup = lookupReference(ref.reference, tsvPath);
for (const ref of references) {
const result = lookupReference(ref.reference, tsvPath);
let text = '';
let verseData: VerseData | null = null;
let text = '';
let verseData: VerseData | null = null;
if (lookup && lookup.verses.length > 0) {
text = `«${lookup.verses.map((v) => v.text).join(' ')}»`;
verseData = {
book: lookup.book,
chapter: lookup.chapter,
verses: lookup.verses
};
} else {
console.warn(`No verses found for: ${ref.reference} in ${tsvPath}`);
}
if (result && result.verses.length > 0) {
text = `«${result.verses.map((v) => v.text).join(' ')}»`;
verseData = {
book: result.book,
chapter: result.chapter,
verses: result.verses
};
} else {
console.warn(`No verses found for: ${ref.reference}`);
descriptions.push({
title: ref.title,
reference: ref.reference,
text,
verseData
});
}
descriptions.push({
title: ref.title,
reference: ref.reference,
text,
verseData
});
result[mysteryType] = descriptions;
}
mysteryDescriptions[mysteryType] = descriptions;
return result;
}
const dePath = resolve('static/allioli.tsv');
const enPath = resolve('static/drb.tsv');
const mysteryVerseDataDe = generateVerseData(mysteryReferences, dePath);
const mysteryVerseDataEn = generateVerseData(mysteryReferencesEnglish, enPath);
const output = `// Auto-generated by scripts/generate-mystery-verses.ts — do not edit manually
import type { MysteryDescription } from './mysteryDescriptions';
export const mysteryVerseData: Record<string, MysteryDescription[]> = ${JSON.stringify(mysteryDescriptions, null, '\t')};
export const mysteryVerseDataDe: Record<string, MysteryDescription[]> = ${JSON.stringify(mysteryVerseDataDe, null, '\t')};
export const mysteryVerseDataEn: Record<string, MysteryDescription[]> = ${JSON.stringify(mysteryVerseDataEn, null, '\t')};
`;
const outPath = resolve('src/lib/data/mysteryVerseData.ts');