工农解放报第二期26.11

This commit is contained in:
Nobody committed 2026-11-12 11:13:28 +08:00
1 parent 97e84fa6c4
commit 5977b1b272
17 files changed
+604 -46

No files matched your search

+19
View File
@@ -131,6 +131,25 @@ export async function generate_md() {
}
}
export async function generate_html() {
await cacheBeforeGeneration();
for (const config of selectedConfigs()) {
const builder = new DocuBuilder(
config,
await createTemplateVariables(args, config, cfg.vars),
);
builder.with_files_sync(config.journal.from_directory);
const html = await builder.as_html_page();
const markdownPath = config.md?.path ?? config.markdown_output;
if (!markdownPath) {
throw new Error("Missing output path in config. Use md.path.");
}
const htmlPath = markdownPath.replace(/\.md$/i, ".html");
await Deno.writeTextFile(htmlPath, html);
console.log(`Generated HTML: ${htmlPath}`);
}
}
export async function generate_txt() {
await cacheBeforeGeneration();
try {
+4
View File
@@ -1,5 +1,6 @@
import {
generate_epub,
generate_html,
generate_md,
generate_pdf,
generate_txt,
@@ -35,6 +36,9 @@ export async function match_sub_command_to_function(
case "md":
await generate_md();
break;
case "html":
await generate_html();
break;
case "txt":
await generate_txt();
break;