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/ --- services/blog/nuldoc-src/slide/parse.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 services/blog/nuldoc-src/slide/parse.ts (limited to 'services/blog/nuldoc-src/slide/parse.ts') diff --git a/services/blog/nuldoc-src/slide/parse.ts b/services/blog/nuldoc-src/slide/parse.ts new file mode 100644 index 00000000..c5a89675 --- /dev/null +++ b/services/blog/nuldoc-src/slide/parse.ts @@ -0,0 +1,20 @@ +import { parse as parseToml } from "@std/toml"; +import { + createNewSlideFromMetadata, + Slide, + SlideMetadataSchema, +} from "./slide.ts"; + +export async function parseSlideFile(filePath: string): Promise { + try { + const root = SlideMetadataSchema.parse( + parseToml(await Deno.readTextFile(filePath)), + ); + return createNewSlideFromMetadata(root, filePath); + } catch (e) { + if (e instanceof Error) { + e.message = `${e.message} in ${filePath}`; + } + throw e; + } +} -- cgit v1.2.3-70-g09d2