https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44151
--- Comment #2 from David Nind <[email protected]> --- Created attachment 212026 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212026&action=edit Bug 44151: Make tidy.pl repair and xt catch commented-out head and body tags The Template Toolkit prettier plugin rewrites </head>, <body ...> and </body> as HTML comments because they are unbalanced inside a single template, and misc/devel/tidy.pl reverts that. A template formatted with prettier directly keeps the comments, so its page is served without a head or body tag. xt/tt_tidy.t did not catch this. Prettier nests an existing <!--</head>--> into <!--<!--</head>-->-->, tidy.pl reverted only the inner pair, so its output equalled the damaged file and the test passed. tidy.pl could not repair a damaged file either. * tidy.pl: revert the plugin substitutions, nested ones included, before prettier runs as well as after, so a damaged file is repaired. xt/tt_tidy.t now fails for a damaged template. * xt/find-commented-head-body.t: new test that fails with the file name and line numbers for a commented-out <head>, <body> or </body>, and says to use tidy.pl. To test: 1. In a template, replace '</head>' with '<!--</head>-->' and '<body ...>' with '<!--<body ...>-->' 2. prove xt/tt_tidy.t => Before the patch: passes, although the template is broken => After the patch: fails for that template 3. perl misc/devel/tidy.pl path/to/template.tt => Before the patch: the comments are still there => After the patch: </head> and <body ...> are restored 4. prove xt/find-commented-head-body.t => Fails with the file name and line numbers while the comments are present, passes once tidy.pl has restored the tags 5. Revert the template and run prove xt/tt_tidy.t xt/find-commented-head-body.t => both pass Signed-off-by: David Nind <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
