diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-09-20 19:56:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-09-20 19:56:57 +0900 |
| commit | a84908b7e8a0e2423afd6b836eccf27a420270b4 (patch) | |
| tree | 00204b62358f8c57fcb36f601db360626484cc1a /vhosts/blog/nuldoc-src/commands | |
| parent | 0b488f85380f964c40b0b9aae69c6611bc7978bc (diff) | |
| download | nsfisis.dev-a84908b7e8a0e2423afd6b836eccf27a420270b4.tar.gz nsfisis.dev-a84908b7e8a0e2423afd6b836eccf27a420270b4.tar.zst nsfisis.dev-a84908b7e8a0e2423afd6b836eccf27a420270b4.zip | |
feat(blog/nuldoc): change content format from DocBook to NulDoc
Diffstat (limited to 'vhosts/blog/nuldoc-src/commands')
| -rw-r--r-- | vhosts/blog/nuldoc-src/commands/build.ts | 8 | ||||
| -rw-r--r-- | vhosts/blog/nuldoc-src/commands/new.ts | 72 |
2 files changed, 33 insertions, 47 deletions
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<PostPage[]> { async function collectPostFiles(sourceDir: string): Promise<string[]> { 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<SlidePage[]> { async function collectSlideFiles(sourceDir: string): Promise<string[]> { 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 `<?xml version="1.0" encoding="UTF-8"?> -<article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0"> - <info> - <title>TODO</title> - <abstract> - TODO - </abstract> - <keywordset> - <keyword>TODO</keyword> - </keywordset> - <revhistory> - <revision> - <date>${date}</date> - <revremark>公開</revremark> - </revision> - </revhistory> - </info> - <section xml:id="TODO"> + return `--- +[article] +title = "TODO" +description = "TODO" +tags = [ + "TODO", +] + +[[article.revisions]] +date = "${date}" +remark = "公開" +--- +<article> + <section id="TODO"> <title>TODO</title> - <para> + <p> TODO - </para> + </p> </section> </article> `; } else { - return `<?xml version="1.0" encoding="UTF-8"?> -<slide> - <info> - <title>TODO</title> - <event> - TODO - </event> - <talktype> - TODO - </talktype> - <link>TODO</link> - <keywordset> - <keyword>TODO</keyword> - </keywordset> - <revhistory> - <revision> - <date>${date}</date> - <revremark>登壇</revremark> - </revision> - </revhistory> - </info> -</slide> + return `[slide] +title = "TODO" +event = "TODO" +talkType = "TODO" +link = "TODO" +tags = [ + "TODO", +] + +[[slide.revisions]] +date = "${date}" +remark = "登壇" `; } } |
