summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-01-15 09:07:26 +0900
committernsfisis <nsfisis@gmail.com>2025-01-15 09:07:26 +0900
commit928dca02c1a955751f19e1c67f34564d436d8009 (patch)
treef7b89198aa499eaa2876226a4e4c2fbb8288e409
parent268f40f597a981930acd176ba09572efd10fb358 (diff)
downloadnsfisis.dev-928dca02c1a955751f19e1c67f34564d436d8009.tar.gz
nsfisis.dev-928dca02c1a955751f19e1c67f34564d436d8009.tar.zst
nsfisis.dev-928dca02c1a955751f19e1c67f34564d436d8009.zip
refactor(blog/nuldoc): use forEachChildRecursively instead of manual recursion
-rw-r--r--vhosts/blog/TODO1
-rw-r--r--vhosts/blog/nuldoc-src/ndoc/to_html.ts7
2 files changed, 2 insertions, 6 deletions
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/<date>/<slug>/` 以下に置いた画像が `./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) {