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/nuldoc-src/ndoc/to_html.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'vhosts/blog/nuldoc-src/ndoc') 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