Remove finale page from book interior
The cover PDF serves this purpose. Removes the page--finale template block, the finale data loading path in build.js, and all finale CSS. Page count: 100 → 99 (imprint + title + TOC + 96 scene pages). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-11
@@ -20,7 +20,6 @@ async function loadStories() {
|
||||
const files = (await readdir(contentDir)).filter(f => f.endsWith('.md')).sort();
|
||||
|
||||
const stories = [];
|
||||
let finale = null;
|
||||
|
||||
for (const file of files) {
|
||||
const raw = await readFile(join(contentDir, file), 'utf-8');
|
||||
@@ -28,11 +27,6 @@ async function loadStories() {
|
||||
|
||||
if (data.type === 'front-matter') continue;
|
||||
|
||||
if (data.type === 'finale') {
|
||||
finale = data;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Split body by --- into individual scene texts
|
||||
const sceneTexts = content.split(/\n---\n/).map(t => t.trim()).filter(Boolean);
|
||||
|
||||
@@ -53,7 +47,7 @@ async function loadStories() {
|
||||
stories.push({ ...data, scenes });
|
||||
}
|
||||
|
||||
return { stories, finale: finale || {} };
|
||||
return stories;
|
||||
}
|
||||
|
||||
async function loadFrontMatter() {
|
||||
@@ -62,15 +56,15 @@ async function loadFrontMatter() {
|
||||
}
|
||||
|
||||
async function build() {
|
||||
const [{ stories, finale }, frontMatter] = await Promise.all([loadStories(), loadFrontMatter()]);
|
||||
const [stories, frontMatter] = await Promise.all([loadStories(), loadFrontMatter()]);
|
||||
|
||||
const html = env.render('book.html', { stories, finale, frontMatter });
|
||||
const html = env.render('book.html', { stories, frontMatter });
|
||||
|
||||
const outPath = join(root, 'output', 'book.html');
|
||||
await writeFile(outPath, html, 'utf-8');
|
||||
|
||||
// imprint + TOC + section-title + (4 scenes × 2 pages per story) + finale
|
||||
const pageCount = 3 + stories.reduce((acc, s) => acc + s.scenes.length * 2, 0) + 1;
|
||||
// imprint + title page + TOC + (4 scenes × 2 pages per story)
|
||||
const pageCount = 3 + stories.reduce((acc, s) => acc + s.scenes.length * 2, 0);
|
||||
await writeFile(
|
||||
join(root, 'output', 'book-meta.json'),
|
||||
JSON.stringify({ pageCount, storyCount: stories.length, builtAt: new Date().toISOString() }, null, 2),
|
||||
|
||||
Reference in New Issue
Block a user