HTML whitespace/commnets cruncher

G

Garry Heaton

Can anyone recommend a perl script for crunching HTML whitespace and
comments? I wish to make duplicates of HTML files for uploading.

Garry Heaton
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Can anyone recommend a perl script for crunching HTML whitespace and
comments? I wish to make duplicates of HTML files for uploading.

Why not gzip the html files? Seems to me that'd be even better.


A quick google search turned up a couple freeware and commercial HTML
strippers. And I seem to recall there's an apache module that does it, but
I'm not sure.

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP5KTlWPeouIeTNHoEQLWUACgpXEJ99HvToQI6liJHMN5tBLWYZMAoKoH
3r8JlfmJtxcwvovr3YPz1/YD
=MhE2
-----END PGP SIGNATURE-----
 
G

Gregory Toomey

It was a dark and stormy night, and Garry Heaton managed to scribble:
Can anyone recommend a perl script for crunching HTML whitespace and
comments? I wish to make duplicates of HTML files for uploading.

Garry Heaton

Would you believe I saw some code yesterday on the net that did this but now I cant find it.

The basic algorithm used regular expressions and was only a few lines long:
convert consecutive whitespace characters to single whitespace
remove whitespace from the beginning of lines
conver consecutive newlines to a single newline

gtoomey
 
T

Tad McClellan

Andrew Shitov said:
Look at the code on this page: http://webcode.ru/cgi/despace1/


It has several bugs in it.

It open()s FILE, but never reads from it.

It uses ampersand on function calls when it does not want the
semantics the go with using ampersand on function calls.

It will mangle spaces in <pre> sections.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top