feat: extract CC
This commit is contained in:
@@ -71,6 +71,33 @@ function loadBooks(): BookInfo[] {
|
||||
});
|
||||
}
|
||||
|
||||
// Śrī Caitanya-caritāmṛta
|
||||
const ccIntroPath = path.join(booksDir, "cc", "intro.json");
|
||||
if (fs.existsSync(ccIntroPath)) {
|
||||
const cc = JSON.parse(fs.readFileSync(ccIntroPath, "utf-8"));
|
||||
const totalChapters = cc.lilas.reduce(
|
||||
(sum: number, l: { totalChapters: number }) => sum + l.totalChapters,
|
||||
0,
|
||||
);
|
||||
const totalVerses = cc.lilas.reduce(
|
||||
(sum: number, l: { chapters: { totalVerses: number }[] }) =>
|
||||
sum +
|
||||
l.chapters.reduce(
|
||||
(s: number, ch: { totalVerses: number }) => s + ch.totalVerses,
|
||||
0,
|
||||
),
|
||||
0,
|
||||
);
|
||||
books.push({
|
||||
slug: "cc",
|
||||
title: cc.title,
|
||||
author: cc.author,
|
||||
description: `${cc.totalLilas} līlās, ${totalChapters} chapters`,
|
||||
totalVerses,
|
||||
href: "/books/cc",
|
||||
});
|
||||
}
|
||||
|
||||
return books;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user