summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/pages
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-14 03:08:58 +0900
committernsfisis <nsfisis@gmail.com>2024-08-14 03:08:58 +0900
commita8e51a340d18c3b4a89c8ec3349b70f0715cd2f8 (patch)
tree99fc7a335718ad63e29d24c7766611f798cd326e /vhosts/blog/nuldoc-src/pages
parent59d83667eda9ecdab05961da81c18f058a8ac065 (diff)
downloadnsfisis.dev-a8e51a340d18c3b4a89c8ec3349b70f0715cd2f8.tar.gz
nsfisis.dev-a8e51a340d18c3b4a89c8ec3349b70f0715cd2f8.tar.zst
nsfisis.dev-a8e51a340d18c3b4a89c8ec3349b70f0715cd2f8.zip
refactor(blog/nuldoc): use object value directly instead of key-value pairs to construct attribute pairs
Diffstat (limited to 'vhosts/blog/nuldoc-src/pages')
-rw-r--r--vhosts/blog/nuldoc-src/pages/about.ts89
-rw-r--r--vhosts/blog/nuldoc-src/pages/home.ts40
-rw-r--r--vhosts/blog/nuldoc-src/pages/not_found.ts14
-rw-r--r--vhosts/blog/nuldoc-src/pages/post.ts38
-rw-r--r--vhosts/blog/nuldoc-src/pages/post_list.ts14
-rw-r--r--vhosts/blog/nuldoc-src/pages/slide.ts48
-rw-r--r--vhosts/blog/nuldoc-src/pages/slide_list.ts14
-rw-r--r--vhosts/blog/nuldoc-src/pages/tag.ts8
-rw-r--r--vhosts/blog/nuldoc-src/pages/tag_list.ts24
9 files changed, 117 insertions, 172 deletions
diff --git a/vhosts/blog/nuldoc-src/pages/about.ts b/vhosts/blog/nuldoc-src/pages/about.ts
index 5ee55629..b5411eb7 100644
--- a/vhosts/blog/nuldoc-src/pages/about.ts
+++ b/vhosts/blog/nuldoc-src/pages/about.ts
@@ -17,81 +17,66 @@ export async function generateAboutPage(
): Promise<AboutPage> {
const body = el(
"body",
- [["class", "single"]],
+ { className: "single" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"article",
- [["class", "post-single"]],
+ { className: "post-single" },
el(
"header",
- [["class", "post-header"]],
- el(
- "h1",
- [["class", "post-title"]],
- "nsfisis",
- ),
+ { className: "post-header" },
+ el("h1", { className: "post-title" }, "nsfisis"),
el(
"div",
- [["class", "my-icon"]],
- await staticScriptElement("/p5.min.js", [], config),
- await staticScriptElement("/my-icon.js", [], config),
- el("div", [["id", "p5jsMyIcon"]]),
+ { className: "my-icon" },
+ await staticScriptElement("/p5.min.js", {}, config),
+ await staticScriptElement("/my-icon.js", {}, config),
+ el("div", { id: "p5jsMyIcon" }),
el(
"noscript",
- [],
- el(
- "img",
- [["src", "/favicon.svg"]],
- ),
+ {},
+ el("img", { src: "/favicon.svg" }),
),
),
),
el(
"div",
- [["class", "post-content"]],
+ { className: "post-content" },
el(
"section",
- [],
- el(
- "h2",
- [],
- "読み方",
- ),
+ {},
+ el("h2", {}, "読み方"),
el(
"p",
- [],
+ {},
"読み方は決めていません。音にする必要があるときは本名である「いまむら」をお使いください。",
),
),
el(
"section",
- [],
- el(
- "h2",
- [],
- "アカウント",
- ),
+ {},
+ el("h2", {}, "アカウント"),
el(
"ul",
- [],
+ {},
el(
"li",
- [],
+ {},
el(
"a",
- [["href", "https://twitter.com/nsfisis"]],
+ { href: "https://twitter.com/nsfisis" },
"Twitter (現 𝕏): @nsfisis",
),
),
el(
"li",
- [],
+ {},
el(
"a",
- [["href", "https://github.com/nsfisis"]],
+ { href: "https://github.com/nsfisis" },
"GitHub: @nsfisis",
),
),
@@ -99,22 +84,18 @@ export async function generateAboutPage(
),
el(
"section",
- [],
- el(
- "h2",
- [],
- "仕事",
- ),
+ {},
+ el("h2", {}, "仕事"),
el(
"ul",
- [],
+ {},
el(
"li",
- [],
+ {},
"2021-01~現在: ",
el(
"a",
- [["href", "https://www.dgcircus.com/"]],
+ { href: "https://www.dgcircus.com/" },
"デジタルサーカス株式会社",
),
),
@@ -122,15 +103,11 @@ export async function generateAboutPage(
),
el(
"section",
- [],
- el(
- "h2",
- [],
- "登壇",
- ),
+ {},
+ el("h2", {}, "登壇"),
el(
"ul",
- [],
+ {},
...Array.from(slides).sort((a, b) => {
const ta = dateToString(getPostPublishedDate(a));
const tb = dateToString(getPostPublishedDate(b));
@@ -140,10 +117,10 @@ export async function generateAboutPage(
}).map((slide) =>
el(
"li",
- [],
+ {},
el(
"a",
- [["href", slide.href]],
+ { href: slide.href },
`${
dateToString(getPostPublishedDate(slide))
}: ${slide.event} (${slide.talkType})`,
@@ -171,7 +148,7 @@ export async function generateAboutPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/about/index.html",
href: "/about/",
diff --git a/vhosts/blog/nuldoc-src/pages/home.ts b/vhosts/blog/nuldoc-src/pages/home.ts
index 773f1d0d..86a767c0 100644
--- a/vhosts/blog/nuldoc-src/pages/home.ts
+++ b/vhosts/blog/nuldoc-src/pages/home.ts
@@ -10,63 +10,63 @@ export type HomePage = Page;
export async function generateHomePage(config: Config): Promise<HomePage> {
const body = el(
"body",
- [["class", "single"]],
+ { className: "single" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"article",
- [["class", "post-single"]],
+ { className: "post-single" },
el(
"article",
- [["class", "post-entry"]],
+ { className: "post-entry" },
el(
"a",
- [["href", "/about/"]],
+ { href: "/about/" },
el(
"header",
- [["class", "entry-header"]],
- el("h2", [], "About"),
+ { className: "entry-header" },
+ el("h2", {}, "About"),
),
),
),
el(
"article",
- [["class", "post-entry"]],
+ { className: "post-entry" },
el(
"a",
- [["href", "/posts/"]],
+ { href: "/posts/" },
el(
"header",
- [["class", "entry-header"]],
- el("h2", [], "Posts"),
+ { className: "entry-header" },
+ el("h2", {}, "Posts"),
),
),
),
el(
"article",
- [["class", "post-entry"]],
+ { className: "post-entry" },
el(
"a",
- [["href", "/slides/"]],
+ { href: "/slides/" },
el(
"header",
- [["class", "entry-header"]],
- el("h2", [], "Slides"),
+ { className: "entry-header" },
+ el("h2", {}, "Slides"),
),
),
),
el(
"article",
- [["class", "post-entry"]],
+ { className: "post-entry" },
el(
"a",
- [["href", "/tags/"]],
+ { href: "/tags/" },
el(
"header",
- [["class", "entry-header"]],
- el("h2", [], "Tags"),
+ { className: "entry-header" },
+ el("h2", {}, "Tags"),
),
),
),
@@ -89,7 +89,7 @@ export async function generateHomePage(config: Config): Promise<HomePage> {
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/index.html",
href: "/",
diff --git a/vhosts/blog/nuldoc-src/pages/not_found.ts b/vhosts/blog/nuldoc-src/pages/not_found.ts
index ab1b3d08..bb70d8ac 100644
--- a/vhosts/blog/nuldoc-src/pages/not_found.ts
+++ b/vhosts/blog/nuldoc-src/pages/not_found.ts
@@ -12,19 +12,15 @@ export async function generateNotFoundPage(
): Promise<NotFoundPage> {
const body = el(
"body",
- [["class", "single"]],
+ { className: "single" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"article",
- [],
- el(
- "div",
- [["class", "not-found"]],
- "404",
- ),
+ {},
+ el("div", { className: "not-found" }, "404"),
),
),
globalFooter(config),
@@ -43,7 +39,7 @@ export async function generateNotFoundPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/404.html",
href: "/404.html",
diff --git a/vhosts/blog/nuldoc-src/pages/post.ts b/vhosts/blog/nuldoc-src/pages/post.ts
index 17670801..c0c3bb2e 100644
--- a/vhosts/blog/nuldoc-src/pages/post.ts
+++ b/vhosts/blog/nuldoc-src/pages/post.ts
@@ -41,33 +41,29 @@ export async function generatePostPage(
): Promise<PostPage> {
const body = el(
"body",
- [["class", "single"]],
+ { className: "single" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"article",
- [["class", "post-single"]],
+ { className: "post-single" },
el(
"header",
- [["class", "post-header"]],
- el(
- "h1",
- [["class", "post-title"]],
- doc.title,
- ),
+ { className: "post-header" },
+ el("h1", { className: "post-title" }, doc.title),
...(doc.tags.length === 0 ? [] : [
el(
"ul",
- [["class", "post-tags"]],
+ { className: "post-tags" },
...doc.tags.map((slug) =>
el(
"li",
- [["class", "tag"]],
+ { className: "tag" },
el(
"a",
- [["href", `/tags/${slug}/`]],
+ { href: `/tags/${slug}/` },
getTagLabel(config, slug),
),
)
@@ -77,25 +73,21 @@ export async function generatePostPage(
),
el(
"div",
- [["class", "post-content"]],
+ { className: "post-content" },
el(
"section",
- [],
- el(
- "h2",
- [["id", "changelog"]],
- "更新履歴",
- ),
+ {},
+ el("h2", { id: "changelog" }, "更新履歴"),
el(
"ol",
- [],
+ {},
...doc.revisions.map((rev) =>
el(
"li",
- [["class", "revision"]],
+ { className: "revision" },
el(
"time",
- [["datetime", dateToString(rev.date)]],
+ { datetime: dateToString(rev.date) },
dateToString(rev.date),
),
`: ${rev.remark}`,
@@ -138,7 +130,7 @@ export async function generatePostPage(
"index.html",
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: destFilePath,
href: destFilePath.replace("index.html", ""),
diff --git a/vhosts/blog/nuldoc-src/pages/post_list.ts b/vhosts/blog/nuldoc-src/pages/post_list.ts
index 2da2b2c6..40df8ed9 100644
--- a/vhosts/blog/nuldoc-src/pages/post_list.ts
+++ b/vhosts/blog/nuldoc-src/pages/post_list.ts
@@ -18,19 +18,15 @@ export async function generatePostListPage(
const body = el(
"body",
- [["class", "list"]],
+ { className: "list" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"header",
- [["class", "page-header"]],
- el(
- "h1",
- [],
- pageTitle,
- ),
+ { className: "page-header" },
+ el("h1", {}, pageTitle),
),
...Array.from(posts).sort((a, b) => {
const ta = dateToString(getPostPublishedDate(a));
@@ -57,7 +53,7 @@ export async function generatePostListPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/posts/index.html",
href: "/posts/",
diff --git a/vhosts/blog/nuldoc-src/pages/slide.ts b/vhosts/blog/nuldoc-src/pages/slide.ts
index b283beb7..15a18bb1 100644
--- a/vhosts/blog/nuldoc-src/pages/slide.ts
+++ b/vhosts/blog/nuldoc-src/pages/slide.ts
@@ -29,33 +29,29 @@ export async function generateSlidePage(
): Promise<SlidePage> {
const body = el(
"body",
- [["class", "single"]],
+ { className: "single" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"article",
- [["class", "post-single"]],
+ { className: "post-single" },
el(
"header",
- [["class", "post-header"]],
- el(
- "h1",
- [["class", "post-title"]],
- slide.title,
- ),
+ { className: "post-header" },
+ el("h1", { className: "post-title" }, slide.title),
...(slide.tags.length === 0 ? [] : [
el(
"ul",
- [["class", "post-tags"]],
+ { className: "post-tags" },
...slide.tags.map((slug) =>
el(
"li",
- [["class", "tag"]],
+ { className: "tag" },
el(
"a",
- [["href", `/tags/${slug}/`]],
+ { href: `/tags/${slug}/` },
getTagLabel(config, slug),
),
)
@@ -65,25 +61,21 @@ export async function generateSlidePage(
),
el(
"div",
- [["class", "post-content"]],
+ { className: "post-content" },
el(
"section",
- [],
- el(
- "h2",
- [["id", "changelog"]],
- "更新履歴",
- ),
+ {},
+ el("h2", { id: "changelog" }, "更新履歴"),
el(
"ol",
- [],
+ {},
...slide.revisions.map((rev) =>
el(
"li",
- [["class", "revision"]],
+ { className: "revision" },
el(
"time",
- [["datetime", dateToString(rev.date)]],
+ { datetime: dateToString(rev.date) },
dateToString(rev.date),
),
`: ${rev.remark}`,
@@ -93,15 +85,15 @@ export async function generateSlidePage(
),
el(
"canvas",
- [["id", "slide"], ["data-slide-link", slide.slideLink]],
+ { id: "slide", "data-slide-link": slide.slideLink },
),
el(
"div",
- [],
- el("button", [["id", "prev"]], "Prev"),
- el("button", [["id", "next"]], "Next"),
+ {},
+ el("button", { id: "prev" }, "Prev"),
+ el("button", { id: "next" }, "Next"),
),
- await staticScriptElement("/slide.js", [["type", "module"]], config),
+ await staticScriptElement("/slide.js", { type: "module" }, config),
),
),
),
@@ -127,7 +119,7 @@ export async function generateSlidePage(
"index.html",
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: destFilePath,
href: destFilePath.replace("index.html", ""),
diff --git a/vhosts/blog/nuldoc-src/pages/slide_list.ts b/vhosts/blog/nuldoc-src/pages/slide_list.ts
index a77a567e..53b2d2b1 100644
--- a/vhosts/blog/nuldoc-src/pages/slide_list.ts
+++ b/vhosts/blog/nuldoc-src/pages/slide_list.ts
@@ -19,19 +19,15 @@ export async function generateSlideListPage(
const body = el(
"body",
- [["class", "list"]],
+ { className: "list" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"header",
- [["class", "page-header"]],
- el(
- "h1",
- [],
- pageTitle,
- ),
+ { className: "page-header" },
+ el("h1", {}, pageTitle),
),
...Array.from(slides).sort((a, b) => {
const ta = dateToString(getPostPublishedDate(a));
@@ -58,7 +54,7 @@ export async function generateSlideListPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/slides/index.html",
href: "/slides/",
diff --git a/vhosts/blog/nuldoc-src/pages/tag.ts b/vhosts/blog/nuldoc-src/pages/tag.ts
index 174f84c3..32711f7e 100644
--- a/vhosts/blog/nuldoc-src/pages/tag.ts
+++ b/vhosts/blog/nuldoc-src/pages/tag.ts
@@ -26,12 +26,12 @@ export async function generateTagPage(
const body = el(
"body",
- [["class", "list"]],
+ { className: "list" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
- el("header", [["class", "page-header"]], el("h1", [], pageTitle)),
+ { className: "main" },
+ el("header", { className: "page-header" }, el("h1", {}, pageTitle)),
...pages.map((page) =>
"event" in page ? slidePageEntry(page) : postPageEntry(page)
),
@@ -53,7 +53,7 @@ export async function generateTagPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: `/tags/${tagSlug}/index.html`,
href: `/tags/${tagSlug}/`,
diff --git a/vhosts/blog/nuldoc-src/pages/tag_list.ts b/vhosts/blog/nuldoc-src/pages/tag_list.ts
index f2e25f6d..57f6a293 100644
--- a/vhosts/blog/nuldoc-src/pages/tag_list.ts
+++ b/vhosts/blog/nuldoc-src/pages/tag_list.ts
@@ -16,19 +16,15 @@ export async function generateTagListPage(
const body = el(
"body",
- [["class", "list"]],
+ { className: "list" },
globalHeader(config),
el(
"main",
- [["class", "main"]],
+ { className: "main" },
el(
"header",
- [["class", "page-header"]],
- el(
- "h1",
- [],
- pageTitle,
- ),
+ { className: "page-header" },
+ el("h1", {}, pageTitle),
),
...Array.from(tags).sort((a, b) => {
const ta = a.tagSlug;
@@ -39,18 +35,18 @@ export async function generateTagListPage(
}).map((tag) =>
el(
"article",
- [["class", "post-entry"]],
+ { className: "post-entry" },
el(
"a",
- [["href", tag.href]],
+ { href: tag.href },
el(
"header",
- [["class", "entry-header"]],
- el("h2", [], tag.tagLabel),
+ { className: "entry-header" },
+ el("h2", {}, tag.tagLabel),
),
el(
"footer",
- [["class", "entry-footer"]],
+ { className: "entry-footer" },
(() => {
const posts = tag.numOfPosts === 0
? ""
@@ -81,7 +77,7 @@ export async function generateTagListPage(
);
return {
- root: el("__root__", [], html),
+ root: el("__root__", {}, html),
renderer: "html",
destFilePath: "/tags/index.html",
href: "/tags/",