fix: Eventseite ohne JavaScript-Syntaxfehler

This commit is contained in:
Leon Tonhäuser committed 2026-07-30 13:04:09 +02:00
1 parent a235112f4b
commit 29f36009f0
2 files changed
+20 -1

No files matched your search

+19
View File
@@ -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(/<script\b([^>]*)>([\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);