[Zope] Surpress white space?

Jaroslav Lukesh lsh@wo.cz
Thu, 10 Jul 2003 08:16:20 +0200


> Odes=EDlatel: Toby Dickenson <tdickenson@geminidataloggers.com>
> Soon after I started using Zope, I created a <dtml-unitws> tag that
replaces=20
> blocks of whitespace with a single character. The code looks a little
dated,=20
> but is still functional. Examle usage below, followed by code. I hope
this=20
> helps.
>=20
>=20
> <dtml-unitws>
>   <dtml-in xxx>
>     <dtml-if comecondition>
>       <dtml-var somevariable>
>     </dtml-if>
>   </dtml-in>
> </dtml-unitws>

It is fantastic idea and i dont know why it is not in zope distro. If you
put start tag into header and end tag into footer documents, it could
minimize your code at minimal level.

But sometimes you want to have absolutelly NO space except you define
between tags. So if somebody will extend this to ignore CR/LF and spaces
=66rom line beginning, publish your script here please.
=20
> from string import split, strip, join, replace
> import DocumentTemplate.DT_Util
> from DocumentTemplate.DT_String import String
>=20
> class UnitWhitespaceTag:
>     """
>     Removes redundant whitespace (not very conservatively)
>     """

Where may I place this script and what is his name?=20

	lib/python/Products/unitws/__init__.py ??

Thanks, JL.