[Boulder.pm] perl/HTML/XHTML

Walter Pienciak walter at frii.com
Fri Oct 18 12:09:35 CDT 2002


Howdy, and welcome to the almost-weekend.

For a web-upload mechanism of mine, I'm adding QC modules that
check/delete pesky Control-M's and whack excessive amounts of
empty lines.

Now, with the file contents in $Content, the first is easy:

 $Content =~ s/^M//go;

But the second, hrmmm.  Because if someone is uploading a file
with preformatted content, we DON'T want to whack those newlines.

So while the simple solution of

 $Content =~ s/\n+/\n/go;

works for 99% of the files on the site, it will destroy the last 1%.

And this is a bit too naive:

 $Content =~ /<pre>/io # Skip it

So, any ideas about a robust solution? Or, for that matter, just
a list of tags that should indicate a hands-off approach?

Walter




More information about the Boulder-pm mailing list