Skip to content

Commit 6f4599c

Browse files
committed
Do post render at the very end
1 parent 18cc853 commit 6f4599c

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/project/types/book/book-render.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
import { outputRecipe } from "../../../command/render/output.ts";
5252
import { renderCleanup } from "../../../command/render/cleanup.ts";
5353

54-
import { kProjectType, ProjectConfig, ProjectContext } from "../../types.ts";
54+
import { ProjectConfig, ProjectContext } from "../../types.ts";
5555
import { ProjectOutputFile } from "../types.ts";
5656

5757
import { executionEngineKeepMd } from "../../../execute/engine.ts";
@@ -588,25 +588,6 @@ export async function bookPostRender(
588588
incremental: boolean,
589589
outputFiles: ProjectOutputFile[],
590590
) {
591-
const outputFormats: Record<string, Format> = {};
592-
outputFiles.forEach((file) => {
593-
if (file.format.pandoc.to) {
594-
outputFormats[file.format.pandoc.to] =
595-
outputFormats[file.format.pandoc.to] || file.format;
596-
}
597-
});
598-
for (const outputFormat of Object.values(outputFormats)) {
599-
const bookExt = outputFormat.extensions?.book as BookExtension;
600-
if (bookExt.bookPostRender) {
601-
await bookExt.bookPostRender(
602-
outputFormat,
603-
context,
604-
incremental,
605-
outputFiles,
606-
);
607-
}
608-
}
609-
610591
// get web output contained in the outputFiles passed to us
611592
const websiteFiles = websiteOutputFiles(outputFiles);
612593
if (websiteFiles.length > 0) {
@@ -625,6 +606,26 @@ export async function bookPostRender(
625606
// run standard website stuff (search, etc.)
626607
await websitePostRender(context, incremental, outputFiles);
627608
}
609+
610+
// Process any post rendering
611+
const outputFormats: Record<string, Format> = {};
612+
outputFiles.forEach((file) => {
613+
if (file.format.pandoc.to) {
614+
outputFormats[file.format.pandoc.to] =
615+
outputFormats[file.format.pandoc.to] || file.format;
616+
}
617+
});
618+
for (const outputFormat of Object.values(outputFormats)) {
619+
const bookExt = outputFormat.extensions?.book as BookExtension;
620+
if (bookExt.bookPostRender) {
621+
await bookExt.bookPostRender(
622+
outputFormat,
623+
context,
624+
incremental,
625+
outputFiles,
626+
);
627+
}
628+
}
628629
}
629630

630631
export async function bookIncrementalRenderAll(

0 commit comments

Comments
 (0)