From 67925bf1d3bd4798e1c3cd9bfae33961a121718f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 15 Jul 2025 09:49:49 +0200 Subject: [PATCH] Bug 39522: Ignore closing html tag to correctly 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. https://gitlab.com/koha-community/prettier-plugin-template-toolkit/-/blob/main/src/parser.ts?ref_type=heads#L242 export const preprocess: Parser["preprocess"] = (text) => { return text .replace("", "") .replace(/") .replace("", ""); }; 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###g; $content =~ s##-->##g; (yes it's a bit messy, but our templates are messy) --- .../test_valuebuilder_popup.tt | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/t/lib/plugins/Koha/Plugin/TestValuebuilder/test_valuebuilder_popup.tt b/t/lib/plugins/Koha/Plugin/TestValuebuilder/test_valuebuilder_popup.tt index 1db60a9777f..93deac4d75c 100644 --- a/t/lib/plugins/Koha/Plugin/TestValuebuilder/test_valuebuilder_popup.tt +++ b/t/lib/plugins/Koha/Plugin/TestValuebuilder/test_valuebuilder_popup.tt @@ -1,29 +1,30 @@ + - - [% plugin_name | html %] - Valuebuilder - - - -

[% plugin_name | html %]

-

This is a test valuebuilder popup for field: [% field_id | html %]

+ + [% plugin_name | html %] - Valuebuilder + + + +

[% plugin_name | html %]

+

This is a test valuebuilder popup for field: [% field_id | html %]

-
- - -

- - -
- - - - \ No newline at end of file +
+ + +

+ + +
+ + + + -- 2.34.1