From 928dca02c1a955751f19e1c67f34564d436d8009 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 15 Jan 2025 09:07:26 +0900 Subject: refactor(blog/nuldoc): use forEachChildRecursively instead of manual recursion --- vhosts/blog/TODO | 1 - vhosts/blog/nuldoc-src/ndoc/to_html.ts | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 vhosts/blog/TODO diff --git a/vhosts/blog/TODO b/vhosts/blog/TODO deleted file mode 100644 index 5fc3ca6e..00000000 --- a/vhosts/blog/TODO +++ /dev/null @@ -1 +0,0 @@ -`./content/posts///` 以下に置いた画像が `./public/` にコピーされない。 diff --git a/vhosts/blog/nuldoc-src/ndoc/to_html.ts b/vhosts/blog/nuldoc-src/ndoc/to_html.ts index ddb041d5..2ca11a93 100644 --- a/vhosts/blog/nuldoc-src/ndoc/to_html.ts +++ b/vhosts/blog/nuldoc-src/ndoc/to_html.ts @@ -27,7 +27,7 @@ export default function toHtml(doc: Document): Document { } function removeUnnecessaryTextNode(doc: Document) { - const g = (n: Node) => { + forEachChildRecursively(doc.root, (n) => { if (n.kind !== "element") { return; } @@ -52,10 +52,7 @@ function removeUnnecessaryTextNode(doc: Document) { changed = true; } } - - forEachChild(n, g); - }; - forEachChild(doc.root, g); + }); } function transformSectionIdAttribute(doc: Document) { -- cgit v1.2.3-70-g09d2