[Zope] TAL page whitespace removal

Robert (Jamie) Munro jamie at textmatters.com
Mon Apr 10 08:14:19 EDT 2006


Due to the structure of TAL, the output of TAL pages often includes a
lot of whitespace that are added to make the source readable, but once
processed the lines they are on can disappear completely. It would be
nice if the TAL parser had an option that could remove all whitespace at
the beginning and end of lines, and remove all blank lines.

For example, I downloaded the www.plone.org home page and it was 47704
bytes. I removed all whitespace from the beginning and end of lines, and
then removed blank lines, and it was down to 35087 bytes - that's a more
than 25% saving, and the output renders exactly the same in web
browsers. This saving will improve load times for the end user, both by
being less to download and less for their browser to hold in memory. For
the server, the improvements are huge. Obviously less bandwidth is
required, but also less space will be needed in the various caches
meaning the caches will expire less, and/or be equally functional will
less RAM or disc space.

The ability to switch off this feature and leave whitespace in for
debugging may be useful, but not very, because you can always use an XML
indenting tool to get readable output from TAL.

Robert (Jamie) Munro


More information about the Zope mailing list