Forums / Suggestions / no-whitespace template operator
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
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.
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