From 674fe965550444db87edc7937ff6932e1a918d9d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 27 Jun 2025 23:39:31 +0900 Subject: feat(meta): rename vhosts/ directory to services/ --- vhosts/blog/nuldoc-src/djot/parse.ts | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 vhosts/blog/nuldoc-src/djot/parse.ts (limited to 'vhosts/blog/nuldoc-src/djot/parse.ts') diff --git a/vhosts/blog/nuldoc-src/djot/parse.ts b/vhosts/blog/nuldoc-src/djot/parse.ts deleted file mode 100644 index c79a6708..00000000 --- a/vhosts/blog/nuldoc-src/djot/parse.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { parse as parseDjot } from "@djot/djot"; -import { parse as parseToml } from "@std/toml"; -import { Config } from "../config.ts"; -import { - createNewDocumentFromDjotDocument, - Document, - PostMetadata, - PostMetadataSchema, -} from "./document.ts"; -import toHtml from "./to_html.ts"; - -export async function parseDjotFile( - filePath: string, - config: Config, -): Promise { - try { - const fileContent = await Deno.readTextFile(filePath); - const [, frontmatter, ...rest] = fileContent.split(/^---$/m); - const meta = parseMetadata(frontmatter); - const root = parseDjot(rest.join("\n")); - const doc = createNewDocumentFromDjotDocument(root, meta, filePath, config); - return await toHtml(doc); - } catch (e) { - if (e instanceof Error) { - e.message = `${e.message} in ${filePath}`; - } - throw e; - } -} - -function parseMetadata(s: string): PostMetadata { - return PostMetadataSchema.parse(parseToml(s)); -} -- cgit v1.2.3-70-g09d2