|
Posted by Toby A Inkster on 03/24/07 00:21
Ciaran wrote:
> The problem is, as Toby mentioned, the compression function messes up
> some things.
I can share a little code with you I suppose... I happen to do exactly the
opposite of what you're describing -- add *more* whitespace to some HTML,
in order to pretty-print it. Obviously, this screws up when you get inside
a PRE or TEXTAREA element, so I made my function smart enough to know when
it's inside one of those.
http://svn.sourceforge.net/viewvc/demiblog/trunk/blog/includes/misc.php?revision=215&view=markup
It's the indent_html() function you're looking for. Obviously, you'll need
to work at it a bit to get it to do what you want, but you should see that
it fairly reliably knows at each point whether or not it's within a "safe
tag" or not.
That said, I'd still advise against your plan. Gzipping your files will be
far more effective, more reliable and easier.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|