Bug 38365: Make tidy.pl compatible with script elements with attributes

tidy.pl will still tidy whitespace around script elements that have
attributes like "nonce"

Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
David Cook 2026-03-05 05:38:12 +00:00 committed by Jonathan Druart
parent 4d589b659d
commit e011f2f6e1
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ sub tidy_tt {
$content =~ s#<!--</head>-->#</head>#g;
$content =~ s#<!--<body(.*)-->#<body$1#g;
$content =~ s#<!--</body>-->#</body>#g;
$content =~ s#\n*( *)<script>\n*#\n$1<script>\n#g;
$content =~ s#\n*( *)(<script\b[^>]*>)\n*#\n$1$2\n#g;
$content =~ s#\n*( *)</script>\n*#\n$1</script>\n#g;
$content =~ s#(\[%\s*SWITCH[^\]]*\]\n)\n#$1#g;