no-whitespace template operator

Author Message

Daniel Staver

Sunday 07 September 2003 2:34:32 pm

I suggest making a template operator that removes all whitespace outside of html-tags within the template operator.

Example:

{no-whitespace}
<img src="test1.gif">
<img src="test2.gif">
<img src="test3.gif">
{/no-whitespace}

This would remove all whitespace between the image tags and place them on one line in the generated code:

<img src="test1.gif"><img src="test2.gif"><img src="test3.gif">

HTML elements such as images, form buttons, list items and CSS inline elements are all affected by linebreaks in the code and often needs to be put on a single line to preserve the intended design of the web-site. This template operator would allow us to keep the template code nicely formatted in such cases.

Daniel Staver
http://daniel.staver.no

Jan Borsodi

Monday 08 September 2003 2:42:36 am

Good idea, this makes it easier to write templates for readability and structure while still getting proper HTML output without extra spaces.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Daniel Staver

Wednesday 10 September 2003 3:32:32 am

I't would also be good if the operator preserved whitespace between text inside tags:

This:

{no-whitespace}
<ul>
<li>This is a text</li>
<li>This another text</li>
</ul>
{/no-whitespace}

Should produce this:

<ul><li>This is a text</li><li>This another text</li></ul>

Not this:

<ul><li>Thisisatext</li><li>Thisanothertext</li></ul>

This is one of the specific cases where I would use the no-whitespace operator. With standard compliant CSS it's possible to format lists to look like rows or columns of buttons, while they will show up as regular lists in older browsers. For this to work it's vital to remove every whitespace between the </li><li> tags, otherwise you get unwanted spacing between the buttons.

Daniel Staver
http://daniel.staver.no

Paul Forsyth

Wednesday 10 September 2003 3:41:15 am

This would be very helpful with browser compatibility. Many of the problems I come across when trying to shape up a site in IE and Mozilla are whitespace-related.

As well as white space could a similar operator help with tabs? I use a lot of tabs when editing to format my files but when it is processed into html the source can be very ugly. Lots of whitespace, new lines and tabs cluttering up the view.

Paul

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 21:33:34
Script start
Timing: Jan 30 2025 21:33:34
Module start 'layout'
Timing: Jan 30 2025 21:33:34
Module start 'content'
Timing: Jan 30 2025 21:33:34
Module end 'content'
Timing: Jan 30 2025 21:33:34
Script end

Main resources:

Total runtime0.7707 sec
Peak memory usage8,192.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.1328151.2109
Module start 'layout' 0.00470.0033 739.3438220.7031
Module start 'content' 0.00800.7617 960.04694,495.4688
Module end 'content' 0.76970.0009 5,455.515612.1641
Script end 0.7706  5,467.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4557160.0002
Check MTime0.00120.1582160.0001
Mysql Total
Database connection0.00090.110810.0009
Mysqli_queries0.684088.7490620.0110
Looping result0.00050.0707600.0000
Template Total0.722693.820.3613
Template load0.00240.305320.0012
Template processing0.720293.451520.3601
Template load and register function0.00120.155310.0012
states
state_id_array0.00170.221510.0017
state_identifier_array0.00130.163520.0006
Override
Cache load0.00190.2428360.0001
Sytem overhead
Fetch class attribute can translate value0.00170.216630.0006
Fetch class attribute name0.00210.270860.0003
XML
Image XML parsing0.00230.300330.0008
class_abstraction
Instantiating content class attribute0.00000.001770.0000
General
dbfile0.00300.3846230.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs