fix of unexpected "Commons" appearing in Bible books

This commit is contained in:
catarrh committed 2026-07-25 18:17:34 +03:00
1 parent 0ec1233752
commit f5722cc200
1 file changed
+4 -1
+4 -1
View File
@@ -15,6 +15,8 @@ const parser = new XMLParser({
trimValues: true, trimValues: true,
}); });
const SKIP_BOOKS = new Set(['Composite']);
interface BibleBookMeta { interface BibleBookMeta {
id: string; id: string;
name: string; name: string;
@@ -88,6 +90,7 @@ export async function convertBibleMeta(SRC: string, OUT: string) {
const bookArr = Array.isArray(bible['BOOK']) ? bible['BOOK'] : [bible['BOOK']]; const bookArr = Array.isArray(bible['BOOK']) ? bible['BOOK'] : [bible['BOOK']];
for (const book of bookArr) { for (const book of bookArr) {
const bookId = book['@_Id'] || book['@_ID'] || ''; const bookId = book['@_Id'] || book['@_ID'] || '';
if (SKIP_BOOKS.has(bookId)) continue;
const bookName = book['@_Name'] || ''; const bookName = book['@_Name'] || '';
const bookShort = book['@_Short'] || book['@_Abbr'] || ''; const bookShort = book['@_Short'] || book['@_Abbr'] || '';
const bookChapters = parseInt(book['@_Chapters'] || '0', 10); const bookChapters = parseInt(book['@_Chapters'] || '0', 10);
@@ -122,7 +125,7 @@ export async function convertBibleMeta(SRC: string, OUT: string) {
if (!existsSync(textSrc)) continue; if (!existsSync(textSrc)) continue;
const textFiles = readdirSync(textSrc).filter(f => f.endsWith('.text')); const textFiles = readdirSync(textSrc).filter(f => f.endsWith('.text') && !SKIP_BOOKS.has(f.replace('.text', '')));
if (textFiles.length === 0) continue; if (textFiles.length === 0) continue;
// Fix: Russian Bibles are under cu/ru/ in source but should go to ru/ in output // Fix: Russian Bibles are under cu/ru/ in source but should go to ru/ in output