From 940eae61767214eb1ee573284dc8b5876d536fb3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 12 Jan 2025 19:44:19 +0900 Subject: refactor(blog/nuldoc): convert pages/*.ts to TSX --- vhosts/blog/nuldoc-src/pages/slide.tsx | 110 +++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 vhosts/blog/nuldoc-src/pages/slide.tsx (limited to 'vhosts/blog/nuldoc-src/pages/slide.tsx') diff --git a/vhosts/blog/nuldoc-src/pages/slide.tsx b/vhosts/blog/nuldoc-src/pages/slide.tsx new file mode 100644 index 00000000..4165163a --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/slide.tsx @@ -0,0 +1,110 @@ +import { join } from "std/path/mod.ts"; +import { renderToDOM } from "../jsx/render.ts"; +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import StaticScript from "../components/StaticScript.tsx"; +import { Config, getTagLabel } from "../config.ts"; +import { el } from "../dom.ts"; +import { Page } from "../page.ts"; +import { Date, dateToString, Revision } from "../revision.ts"; +import { Slide } from "../slide/slide.ts"; +import { getPostPublishedDate, getPostUpdatedDate } from "./post.tsx"; + +export interface SlidePage extends Page { + title: string; + description: string; + event: string; + talkType: string; + slideLink: string; + tags: string[]; + revisions: Revision[]; + published: Date; + updated: Date; + uuid: string; +} + +export async function generateSlidePage( + slide: Slide, + config: Config, +): Promise { + const html = await renderToDOM( + getTagLabel(config, slug))} + metaTitle={`${slide.event} (${slide.talkType})|${config.blog.siteName}`} + requiresSyntaxHighlight + config={config} + > + + +
+
+
+

{slide.title}

+ {slide.tags.length !== 0 && ( + + )} +
+
+
+

更新履歴

+
    + {slide.revisions.map((rev) => ( +
  1. + + {`: ${rev.remark}`} +
  2. + ))} +
+
+ +
+ + +
+ +
+
+
+ + +
, + ); + + const cwd = Deno.cwd(); + const contentDir = join(cwd, config.locations.contentDir); + const destFilePath = join( + slide.sourceFilePath.replace(contentDir, "").replace(".toml", ""), + "index.html", + ); + return { + root: el("__root__", {}, html), + renderer: "html", + destFilePath: destFilePath, + href: destFilePath.replace("index.html", ""), + title: slide.title, + description: `登壇: ${slide.event} (${slide.talkType})`, + event: slide.event, + talkType: slide.talkType, + slideLink: slide.slideLink, + tags: slide.tags, + revisions: slide.revisions, + published: getPostPublishedDate(slide), + updated: getPostUpdatedDate(slide), + uuid: slide.uuid, + }; +} -- cgit v1.2.3-70-g09d2