From d8c7e198e4338be30a33909666083154056eedba Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 6 May 2025 00:20:40 +0900 Subject: feat(blog/nuldoc): fix processing of tight list --- vhosts/blog/nuldoc-src/djot/to_html.ts | 15 ++--- .../index.html | 4 +- .../ruby-then-keyword-and-case-in/index.html | 4 +- .../index.html | 16 ++---- .../index.html | 8 +-- .../index.html | 20 ++----- .../2023-04-04/phperkaigi-2023-report/index.html | 8 +-- .../2023-06-25/phpconfuk-2023-report/index.html | 24 ++------ .../public/posts/2023-12-03/isucon-13/index.html | 8 +-- .../posts/2023-12-31/2023-reflections/index.html | 12 +--- .../2024-02-10/yapcjapan-2024-report/index.html | 12 +--- .../2024-02-22/phpkansai-2024-report/index.html | 12 +--- .../2024-03-17/phperkaigi-2024-report/index.html | 4 +- .../phpcon-odawara-2024-report/index.html | 16 ++---- .../2024-05-11/phpconkagawa-2024-report/index.html | 20 ++----- .../2024-06-19/scalamatsuri-2024-report/index.html | 8 +-- .../posts/2024-12-33/2024-reflections/index.html | 12 +--- .../phperkaigi-2023-tokens-q1/index.html | 16 ++---- .../phpcon-nagoya-2025-report/index.html | 8 +-- .../make-tiny-self-hosted-c-compiler/index.html | 64 ++++++---------------- 20 files changed, 77 insertions(+), 214 deletions(-) diff --git a/vhosts/blog/nuldoc-src/djot/to_html.ts b/vhosts/blog/nuldoc-src/djot/to_html.ts index f31408da..3c95c14b 100644 --- a/vhosts/blog/nuldoc-src/djot/to_html.ts +++ b/vhosts/blog/nuldoc-src/djot/to_html.ts @@ -283,14 +283,15 @@ function removeUnnecessaryParagraphNode(doc: Document) { if (child.kind !== "element" || child.name !== "li") { continue; } - if (child.children.length !== 1) { - continue; - } - const grandChild = child.children[0]; - if (grandChild.kind !== "element" || grandChild.name !== "p") { - continue; + const newGrandChildren: Node[] = []; + for (const grandChild of child.children) { + if (grandChild.kind === "element" && grandChild.name === "p") { + newGrandChildren.push(...grandChild.children); + } else { + newGrandChildren.push(grandChild); + } } - child.children = grandChild.children; + child.children = newGrandChildren; } }); } diff --git a/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html b/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html index 16c466ba..52cb5a45 100644 --- a/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html +++ b/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html @@ -118,9 +118,7 @@