From ee72f8780cf3681e4202cc3a6358fb4038db1ec8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 17 Mar 2023 01:03:59 +0900 Subject: feat(nuldoc): implement /about/ page (work in progress) --- nuldoc-src/command.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nuldoc-src/command.ts') diff --git a/nuldoc-src/command.ts b/nuldoc-src/command.ts index 70532d4..57e4820 100644 --- a/nuldoc-src/command.ts +++ b/nuldoc-src/command.ts @@ -10,6 +10,7 @@ import { Document } from "./docbook/document.ts"; import convertPost from "./templates/post.ts"; import convertPostList from "./templates/post_list.ts"; import convertTag from "./templates/tag.ts"; +import generateAbout from "./templates/about.ts"; export async function run(command: string, config: Config) { if (command === "build") { @@ -25,6 +26,7 @@ async function cmdBuild(config: Config) { const posts = await generatePosts(config); await generateTags(posts, config); await generatePostList(posts, config); + await generateAboutPage(config); await copyStaticFiles(config); } @@ -110,6 +112,19 @@ async function outputPostList(postList: Document, config: Config) { await writeHtmlFile(postList, destFilePath); } +async function generateAboutPage(config: Config) { + const aboutDoc = await generateAbout(config); + await outputAboutPage(aboutDoc, config); +} + +async function outputAboutPage(about: Document, config: Config) { + const cwd = Deno.cwd(); + const destDir = join(cwd, config.locations.destDir); + const destFilePath = join(destDir, "about", "index.html"); + await ensureDir(dirname(destFilePath)); + await writeHtmlFile(about, destFilePath); +} + async function generateTags(posts: Document[], config: Config) { const tagsAndPosts = collectTags(posts); const tagDocs = await buildTagDocs(tagsAndPosts, config); -- cgit v1.2.3-70-g09d2