Koha-clms/t/lib
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
..
IdP Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha/BackgroundJob Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Mocks Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
QA Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
bad_plugins/Koha/Plugin Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
plugins/Koha/Plugin Bug 39522: Ignore the whole file for tidy 2026-01-12 10:53:33 -07:00
Bootstrap.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Dates.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Mocks.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Selenium.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TestBuilder.pm Bug 40680: Fix TestBuilder 2025-12-01 08:33:59 -07:00