From 29f36009f03838d49abc76233f1e4e50bde595cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Thu, 30 Jul 2026 13:04:09 +0200 Subject: [PATCH] fix: Eventseite ohne JavaScript-Syntaxfehler --- public/eventfotografie.html | 2 +- scripts/check-seo.mjs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/public/eventfotografie.html b/public/eventfotografie.html index 1506cce..f3617ad 100644 --- a/public/eventfotografie.html +++ b/public/eventfotografie.html @@ -19,7 +19,7 @@ diff --git a/scripts/check-seo.mjs b/scripts/check-seo.mjs index f52f1fe..d099ac5 100644 --- a/scripts/check-seo.mjs +++ b/scripts/check-seo.mjs @@ -293,6 +293,25 @@ if (wants('links')) { }); } +if (wants('syntax')) { + check('alle ausführbaren Inline-Skripte der Top-Level-Seiten sind syntaktisch gültig', () => { + const files = readdirSync(PUBLIC).filter((file) => file.endsWith('.html')).sort(); + for (const file of files) { + const html = pageHtml(file); + const scripts = Array.from( + html.matchAll(/]*)>([\s\S]*?)<\/script>/gi), + (match) => ({ attributes: match[1], source: match[2] }) + ); + for (const [index, script] of scripts.entries()) { + if (/\bsrc\s*=/i.test(script.attributes) || /\btype\s*=\s*["']application\/ld\+json["']/i.test(script.attributes)) { + continue; + } + new vm.Script(script.source, { filename: `${file} inline script ${index + 1}` }); + } + } + }); +} + if (failures.length) { console.error(`\n${failures.length} Prüfung(en) fehlgeschlagen.`); process.exit(1);