[ic] Pragma no_white working?

Davor Ocelic docelic at hcoop.net
Sun Mar 11 16:36:46 EST 2007


On Sun, Mar 11, 2007 at 02:11:38PM -0700, Grant wrote:
> >> Hello, could anyone using a recent version of IC tell me if Pragma
> >> no_white is working to eliminate all white space from delivered HTML?
> >> A no_white filter is documented, but a Pragma was mentioned on this
> >> list a while back.
> >
> >I remember that post. It was a mistake on part of the author,
> >there's no no_white pragma, he meant filter.
> 
> I just tried the no_white filter and apparently no_white really means
> no white.  I wrote a new filter to remove blank lines only:
> 
> CodeDef no_blank_lines Routine <<EOR
> sub {
> my $val = shift;
> $val =~ s/\n+/\n/g;
> return $val;
> }
> EOR
>
> and wrapped that around my bottom template which contains most of my
> HTML.  Unfortunately it didn't work.  I get just as many blank lines.

Well, my guess is that blank lines are a leftover from processing of
Interchange tags which return no value. And that whitespace isn't 
all newlines, there are some spaces on those lines.

So try something like =~ s/\s*\n+\s*/\n/g;

> >One other thing you could do is put all pages through HTMLTidy
> >or indent to fix/reformat them before sending to user. This
> >functionality (passing data through external program) is not working
> >since a few years ago (and obviously noone was using it), but the fix is
> >on my todo list.
> 
> Do you mean mod_tidy?  I'm in a discussion with a guy on the apache
> list about mod_tidy and he has urged me to steer clear of it.

No, I mean htmltidy or indent.. external programs used for formatting
input, and not related to apache in any way.

They are probably slow to run and all, so you won't want them on a
busy site.

-doc


More information about the interchange-users mailing list