Summary: | Remove all empty lines from template's output | ||
---|---|---|---|
Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
Component: | Templates | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, dcook, nick |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This removes extra blank lines from the HTML page source for OPAC and staff interface pages. The HTML page source should now be more compact, which should make it easier to read.
(The extra blank lines are caused by the way HTML output is generated by the Template Toolkit - it includes whitespace anywhere there is a template tag.)
|
Version(s) released in: | |
Circulation function: | |||
Attachments: |
Bug 36333: Remove empty lines from template's output
Bug 36333: Remove empty lines from template's output |
Description
Jonathan Druart
2024-03-15 14:15:39 UTC
Created attachment 163242 [details] [review] Bug 36333: Remove empty lines from template's output This patch removes empty lines (containing only whitespaces) from the output. It does not have the intented result, we don't gain much in term of size. However the source is way cleaner and easier to read. Created attachment 163279 [details] [review] Bug 36333: Remove empty lines from template's output This patch removes empty lines (containing only whitespaces) from the output. It does not have the intented result, we don't gain much in term of size. However the source is way cleaner and easier to read. Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD): 1. View the page source for some OPAC and staff interface pages (for example: home pages for staff interface and OPC, and the details page for a record). 2. Notice that there are a lot of empty lines. 3. Apply the patch. 4. Repeat step 1. 5. Now notice that the JTML page source is much more compact, with minimal extra blank lines. Some examples: - OPAC home page: before - 944 lines; after - 398 lines - OPAC detail page (262 - Programming perl): before - 2487 lines; after - 1285 lines - Staff interface home page: before - 1326 lines; after - 706 lines - Staff detail page (262 - Programming perl): before - 2754 lines; after - 1837 lines Example source for staff interface home page ============================================ Before ~~~~~~ <!DOCTYPE html> <!-- TEMPLATE FILE: intranet-main.tt --> <html lang="en"> <head> <title>Koha staff interface</title> <link href="/intranet-tmpl/prog/css/mainpage_23.1200007.css" type="text/css" rel="stylesheet"> After ~~~~~ <!DOCTYPE html> <!-- TEMPLATE FILE: intranet-main.tt --> <html lang="en"> <head> <title>Koha staff interface</title> <link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/css/mainpage_23.1200007.css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="csrf-token" content="2d7ba25b9f496ed95c17a4329ad494e72ed7fff2,3a063148798d7315f4ba188017bd48dad177740b,1710535727"> <meta name="generator" content="Koha 23.12.00" /> <style id="antiClickjack">body{display:none !important;}</style> <link rel="shortcut icon" href="/intranet-tmpl/prog/img/favicon.ico" type="image/x-icon" /> <link type="text/css" rel="stylesheet" href="/intranet-tmpl/lib/jquery/jquery-ui-1.13.2.min_23.1200007.css"> <link type="text/css" rel="stylesheet" href="/intranet-tmpl/lib/bootstrap/bootstrap.min_23.1200007.css"> <link href="/intranet-tmpl/lib/bootstrap/bootstrap-theme.min_23.1200007.css" type="text/css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="/intranet-tmpl/lib/fontawesome/css/fontawesome.min_23.1200007.css"> <link href="/intranet-tmpl/lib/fontawesome/css/brands.min_23.1200007.css" type="text/css" rel="stylesheet"> <link href="/intranet-tmpl/lib/fontawesome/css/solid.min_23.1200007.css" type="text/css" rel="stylesheet"> <link type="text/css" rel="stylesheet" href="/intranet-tmpl/lib/datatables/datatables.min_23.1200007.css"> <link href="/intranet-tmpl/prog/css/print_23.1200007.css" type="text/css" rel="stylesheet" media="print"> <link type="text/css" rel="stylesheet" href="/intranet-tmpl/prog/css/staff-global_23.1200007.css"> <!-- local colors --> <script type="module"> import { APIClient } from '/intranet-tmpl/prog/js/fetch/api-client.js'; window.APIClient = APIClient; </script> <script> var Koha = {}; var CAN_user_parameters_manage_column_config = 1; </script> I don't know about this. Surely this would accidentally remove empty lines in unexpected ways? (In reply to David Cook from comment #4) > I don't know about this. Surely this would accidentally remove empty lines > in unexpected ways? Maybe, I didn't find any. Did you? I guess it's an hard code to anticipate. We can push and see. Revert will be trivial if needed. (In reply to David Cook from comment #4) > I don't know about this. Surely this would accidentally remove empty lines > in unexpected ways? Maybe, I didn't find any. Did you? I guess it's an hard one to anticipate. We can push and see. Revert will be trivial if needed. It silently removes blank lines from notices and sysprefs :-( |