Bug 39522: Ignore the whole file for tidy
The prettier plugin for TT has been adjusted to correctly parse our TT files: most of them does not have an opening head but have a closing head, then have an opening body but no closing body. To avoid the parser to fail we are commenting those lines in a pre-process step in the plugin, then uncomment them in the tidy script. Which means we actually cannot parse correctly formatted HTML files. https://gitlab.com/koha-community/prettier-plugin-template-toolkit/-/blob/main/src/parser.ts?ref_type=heads#L242 export const preprocess: Parser<Node>["preprocess"] = (text) => { return text .replace("</head>", "<!--</head>-->") .replace(/<body(.*)/, "<!--<body$1-->") .replace("</body>", "<!--</body>-->"); }; https://git.koha-community.org/Koha-community/Koha/src/branch/main/misc/devel/tidy.pl#L168 # Revert the substitutions done by the prettier plugin my $content = read_file($file); $content =~ s#<!--</head>-->#</head>#g; $content =~ s#<!--<body(.*)-->#<body$1#g; $content =~ s#<!--</body>-->#</body>#g; (yes it's a bit messy, but our templates are messy) Signed-off-by: Catherine Small <c.small@rcs.ac.uk> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
856e6d3b38
commit
508a8de6f0
|
|
@ -1,29 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- prettier-ignore-start -->
|
||||
<html>
|
||||
<head>
|
||||
<title>[% plugin_name | html %] - Valuebuilder</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>[% plugin_name | html %]</h1>
|
||||
<p>This is a test valuebuilder popup for field: [% field_id | html %]</p>
|
||||
<head>
|
||||
<title>[% plugin_name | html %] - Valuebuilder</title>
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>[% plugin_name | html %]</h1>
|
||||
<p>This is a test valuebuilder popup for field: [% field_id | html %]</p>
|
||||
|
||||
<form>
|
||||
<label for="test_value">Enter a value:</label>
|
||||
<input type="text" id="test_value" value="Test Value from Plugin">
|
||||
<br><br>
|
||||
<button type="button" onclick="setValueAndClose()">Set Value</button>
|
||||
<button type="button" onclick="window.close()">Cancel</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function setValueAndClose() {
|
||||
var value = document.getElementById('test_value').value;
|
||||
if (window.opener && window.opener.document.getElementById('[% field_id | html %]')) {
|
||||
window.opener.document.getElementById('[% field_id | html %]').value = value;
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<form>
|
||||
<label for="test_value">Enter a value:</label>
|
||||
<input type="text" id="test_value" value="Test Value from Plugin" />
|
||||
<br /><br />
|
||||
<button type="button" onclick="setValueAndClose()">Set Value</button>
|
||||
<button type="button" onclick="window.close()">Cancel</button>
|
||||
</form>
|
||||
<script>
|
||||
function setValueAndClose() {
|
||||
var value = document.getElementById('test_value').value;
|
||||
if (window.opener && window.opener.document.getElementById('[% field_id | html %]')) {
|
||||
window.opener.document.getElementById('[% field_id | html %]').value = value;
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<!-- prettier-ignore-end -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue