From a84908b7e8a0e2423afd6b836eccf27a420270b4 Mon Sep 17 00:00:00 2001
From: nsfisis
Date: Wed, 20 Sep 2023 19:56:52 +0900
Subject: feat(blog/nuldoc): change content format from DocBook to NulDoc
---
vhosts/blog/nuldoc-src/commands/build.ts | 8 ++--
vhosts/blog/nuldoc-src/commands/new.ts | 72 +++++++++++++-------------------
2 files changed, 33 insertions(+), 47 deletions(-)
(limited to 'vhosts/blog/nuldoc-src/commands')
diff --git a/vhosts/blog/nuldoc-src/commands/build.ts b/vhosts/blog/nuldoc-src/commands/build.ts
index da7e5cec..92230d7d 100644
--- a/vhosts/blog/nuldoc-src/commands/build.ts
+++ b/vhosts/blog/nuldoc-src/commands/build.ts
@@ -2,7 +2,7 @@ import { dirname, join, joinGlobs } from "std/path/mod.ts";
import { ensureDir } from "std/fs/mod.ts";
import { expandGlob } from "std/fs/expand_glob.ts";
import { Config } from "../config.ts";
-import { parseDocBookFile } from "../docbook/parse.ts";
+import { parseNulDocFile } from "../ndoc/parse.ts";
import { Page } from "../page.ts";
import { render } from "../render.ts";
import { dateToString } from "../revision.ts";
@@ -48,7 +48,7 @@ async function buildPostPages(config: Config): Promise {
async function collectPostFiles(sourceDir: string): Promise {
const filePaths = [];
- const globPattern = joinGlobs([sourceDir, "**", "*.xml"]);
+ const globPattern = joinGlobs([sourceDir, "**", "*.ndoc"]);
for await (const entry of expandGlob(globPattern)) {
filePaths.push(entry.path);
}
@@ -62,7 +62,7 @@ async function parsePosts(
const posts = [];
for (const postFile of postFiles) {
posts.push(
- await generatePostPage(await parseDocBookFile(postFile, config), config),
+ await generatePostPage(await parseNulDocFile(postFile, config), config),
);
}
return posts;
@@ -85,7 +85,7 @@ async function buildSlidePages(config: Config): Promise {
async function collectSlideFiles(sourceDir: string): Promise {
const filePaths = [];
- const globPattern = joinGlobs([sourceDir, "**", "*.xml"]);
+ const globPattern = joinGlobs([sourceDir, "**", "*.toml"]);
for await (const entry of expandGlob(globPattern)) {
filePaths.push(entry.path);
}
diff --git a/vhosts/blog/nuldoc-src/commands/new.ts b/vhosts/blog/nuldoc-src/commands/new.ts
index 22329972..36125755 100644
--- a/vhosts/blog/nuldoc-src/commands/new.ts
+++ b/vhosts/blog/nuldoc-src/commands/new.ts
@@ -21,7 +21,7 @@ export async function runNewCommand(config: Config) {
config.locations.contentDir,
getDirPath(type),
ymd,
- "TODO.xml",
+ "TODO.ndoc",
);
await ensureDir(dirname(destFilePath));
@@ -39,54 +39,40 @@ function getDirPath(type: "post" | "slide"): string {
function getTemplate(type: "post" | "slide", date: string): string {
if (type === "post") {
- return `
-
-
- TODO
-
- TODO
-
-
- TODO
-
-
-
- ${date}
- 公開
-
-
-
-
+ return `---
+[article]
+title = "TODO"
+description = "TODO"
+tags = [
+ "TODO",
+]
+
+[[article.revisions]]
+date = "${date}"
+remark = "公開"
+---
+
+
`;
} else {
- return `
-
-
- TODO
-
- TODO
-
-
- TODO
-
- TODO
-
- TODO
-
-
-
- ${date}
- 登壇
-
-
-
-
+ return `[slide]
+title = "TODO"
+event = "TODO"
+talkType = "TODO"
+link = "TODO"
+tags = [
+ "TODO",
+]
+
+[[slide.revisions]]
+date = "${date}"
+remark = "登壇"
`;
}
}
--
cgit v1.2.3-70-g09d2