I was thinking of this exact problem today.  I usually get my templates
working first but laying them out so they are readable then remove the \n's
when they work nicely so the resulting HTML looks cleaner.

One suggestion would be to have a flag in the NEW method that could handle
the \n's the way the programmer needs it to work in a given situatation.


Keith Jackson
Chief Geek
Interactive Media Group
www.eyemg.com
330.434.7873
_____Note our new address__________
190 N. Union St.
Suite 300
Akron, OH 44304

-----Original Message-----
From: Sam Tregar [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 24, 2001 1:18 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [htmltmpl] HTML::Template keeps newlines

On Mon, 24 Sep 2001 [EMAIL PROTECTED] wrote:

> I've found that HTML::Template keeps the "\n"(newline, if that
> character screws up your mail reader) in it's template parsing.

Yup, that's by design.  Think about it for a moment and you'll realize
that's the only sane option.  HTML::Template is totally content-neutral -
it might be generating HTML, which doesn't care much about space, or it
might be generating text into a <pre> block where trying to get cute with
newlines would ruin the whole layout.

> Is there anyway to get rid of those empty newlines when they are from
> lines that are strictly HTML::Template directives? Especially when you
> get into large loops, you get a lot of useless space in your HTML.
> This would also offer a little bit of bandwidth savings.

Two options:

  - Don't put them in in the first place.  It will make your templates
    ugly but your output will be prettier.

  - Use an HTML compressor on the output of HTML::Template.  There are
    many to choose from and they'll treat all the extraneous space in your
    document, not just the stuff around template tags.

-sam



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to