https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39522

Jacob O'Mara <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #189540|0                           |1
        is obsolete|                            |

--- Comment #29 from Jacob O'Mara <[email protected]> ---
Created attachment 189548
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189548&action=edit
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 <[email protected]>
Signed-off-by: Owen Leonard <[email protected]>
Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to