Koha-clms/t/lib/plugins/Koha/Plugin
Jonathan Druart 508a8de6f0
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>
2026-01-12 10:53:33 -07:00
..
ILL Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Test Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TestValuebuilder Bug 39522: Ignore the whole file for tidy 2026-01-12 10:53:33 -07:00
1_CalcFineEmpty.pm Bug 39405: Add more plugin examples to build tests 2025-04-25 08:46:48 +02:00
2_CalcFineNotEmpty.pm Bug 39405: Add more plugin examples to build tests 2025-04-25 08:46:48 +02:00
3_CalcFineBadValue.pm Bug 39405: Add more plugin examples to build tests 2025-04-25 08:46:48 +02:00
BackendClass.pm Bug 39092: Unit tests 2025-04-25 18:34:50 +02:00
BadAPIRoute.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
MarcFieldValues.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Test.pm Bug 40983: Complete deprecation of old after_biblio_action hook signature 2025-10-14 14:51:53 -06:00
TestItemBarcodeTransform.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
TestValuebuilder.pm Bug 39522: Add unit tests for valuebuilder plugin hooks 2026-01-12 10:53:32 -07:00