Bugzilla – Attachment 184071 Details for
Bug 39522
Add hooks to allow 'Valuebuilder' plugins to be installable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39522: Ignore closing html tag to correctly tidy
Bug-39522-Ignore-closing-html-tag-to-correctly-tid.patch (text/plain), 3.86 KB, created by
Jonathan Druart
on 2025-07-15 08:02:08 UTC
(
hide
)
Description:
Bug 39522: Ignore closing html tag to correctly tidy
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-15 08:02:08 UTC
Size:
3.86 KB
patch
obsolete
>From 67925bf1d3bd4798e1c3cd9bfae33961a121718f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >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<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) >--- > .../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 @@ > <!DOCTYPE html> >+<!-- prettier-ignore-start --> > <html> >-<head> >- <title>[% plugin_name | html %] - Valuebuilder</title> >- <meta charset="UTF-8"> >-</head> >-<body> >- <h1>[% plugin_name | html %]</h1> >- <p>This is a test valuebuilder popup for field: [% field_id | html %]</p> >+ <head> >+ <title>[% plugin_name | html %] - Valuebuilder</title> >+ <meta charset="UTF-8" /> >+ </head> >+ <body> >+ <h1>[% plugin_name | html %]</h1> >+ <p>This is a test valuebuilder popup for field: [% field_id | html %]</p> > >- <form> >- <label for="test_value">Enter a value:</label> >- <input type="text" id="test_value" value="Test Value from Plugin"> >- <br><br> >- <button type="button" onclick="setValueAndClose()">Set Value</button> >- <button type="button" onclick="window.close()">Cancel</button> >- </form> >- >- <script> >- function setValueAndClose() { >- var value = document.getElementById('test_value').value; >- if (window.opener && window.opener.document.getElementById('[% field_id | html %]')) { >- window.opener.document.getElementById('[% field_id | html %]').value = value; >- } >- window.close(); >- } >- </script> >-</body> >-</html> >\ No newline at end of file >+ <form> >+ <label for="test_value">Enter a value:</label> >+ <input type="text" id="test_value" value="Test Value from Plugin" /> >+ <br /><br /> >+ <button type="button" onclick="setValueAndClose()">Set Value</button> >+ <button type="button" onclick="window.close()">Cancel</button> >+ </form> >+ <script> >+ function setValueAndClose() { >+ var value = document.getElementById('test_value').value; >+ if (window.opener && window.opener.document.getElementById('[% field_id | html %]')) { >+ window.opener.document.getElementById('[% field_id | html %]').value = value; >+ } >+ window.close(); >+ } >+ </script> >+ </body> >+</html> >+<!-- prettier-ignore-end --> >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39522
:
180283
|
180284
|
180301
|
180302
|
180337
|
180338
|
183467
|
183468
|
183469
|
184030
|
184031
|
184032
|
184033
|
184034
|
184071
|
184072