I always use the cache options, so I've never really cared about the speed
of how much the filter effects the rendering.  However, this seems like it
would be a fairly simple regex, and if there is something that perl does
really fast, it's regexes.  I would think that doing a regex on 100K of data
would be incredibly fast.

Brian

-----Original Message-----
From: Drew Taylor [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 11, 2003 4:53 PM
To: Paulsen, Brian
Cc: [EMAIL PROTECTED]
Subject: RE: [htmltmpl] Trimming whitespace


Ok, I buy that. My final question is how does adding filters affect the 
speed? It seems like adding a couple filters that work on 20-100kb of text 
would start to bog down under high load. Of course, that's really a 
non-issue since we'll never come close to approaching a "high" load but I 
still wonder. :-)

IMHO, as the parser is working through the document it seems it would be 
relatively simple to tweak the substitutions being done. Caveat: I've never 
tried to follow the H:T code.

Drew

At 04:13 PM 2/11/03 -0500, Paulsen, Brian wrote:
>Well, if we had people providing these filter functions, it still would 
>be a simple config option:
>
>It might look something like this:
>
>my %opts = (
>    filter => [ HTML::Template::Filter::PreChomp, 
>HTML::Template::FilterPostChomp ]
>)
>$tt = Template->new( %opts );
>
>Brian
>
>-----Original Message-----
>From: Drew Taylor [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, February 11, 2003 4:08 PM
>To: Paulsen, Brian
>Cc: [EMAIL PROTECTED]
>Subject: RE: [htmltmpl] Trimming whitespace
>
>
>I'm coming from the TT world, where this is just an option to new(). I 
>get all kinds of useful options to make the results look prettier:
>
>my %opts = (
>    TRIM => 1,
>    PRE_CHOMP => 1,
>    POST_CHOMP => 1,
>);
>$tt = Template->new(%opts);
>
>  From http://www.template-toolkit.org/docs/default/Manual/Config.html
> >PRE_CHOMP, POST_CHOMP
> >
> >Anything outside a directive tag is considered plain text and is 
> >generally passed through unaltered (but see the INTERPOLATE option). 
> >This includes all whitespace and newlines characters surrounding 
> >directive tags. Directives that don't generate any output will leave 
> >gaps in the output document.
>
>That's what I want - a simple config option. If this adds a filter 
>behind the scenes I don't care. No, it doesn't matter much to the 
>resulting HTML. But nicely formatted & spaced HTML makes it easier for 
>me when there's a problem and I'm trying to find it. Yes, I create my 
>H:T object in a centralized place and could easily add a filter, but 
>that's not the point.
>:-)
>
>Drew
>
>At 03:27 PM 2/11/03 -0500, Paulsen, Brian wrote:
> >I'm still at a loss why a simple filter function couldn't do this 
> >work.
> >
> >Perhaps what we need is people to contribute filter functions to do 
> >these kinds of things.
> >
> >Brian
> >
> >-----Original Message-----
> >From: Jody Biggs [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, February 11, 2003 3:19 PM
> >To: simran; Jay 'Whip' Grizzard
> >Cc: [EMAIL PROTECTED]
> >Subject: Re: [htmltmpl] Trimming whitespace
> >
> >
> >hear hear!
> >
> >I've got some _extremely_ ugly templates that are outputting CSV or 
> >tab delimited data, as they loop through data cells in each row, and 
> >have several conditions within each row and cell...
> >
> >perhaps it would be reasonable to consider adding an option for 
> >stripping white space out of lines which contain nothing but an 
> >HTML::Template tag?
> >
> >  - j
> >
> >--- simran <[EMAIL PROTECTED]> wrote:
> > > On Tue, 2003-02-11 at 05:27, Jay 'Whip' Grizzard wrote:
> > > > On Fri, Feb 07, 2003 at 12:54:59PM -0500, Sam Tregar wrote:
> > > > > On Fri, 7 Feb 2003, Drew Taylor wrote:
> > > > >
> > > > > > Is there a way to trim the extra whitespace\newlines from 
> > > > > > the
> > > final output?
> > > > > > I didn't notice anything in the docs so I thought I'd ask 
> > > > > > here.
> > > > >
> > > > > HTML::Clean works for some people.  In general I don't let it
> > > bother me.
> > > > > It's just a few extra bytes and the browser certainly doesn't
> > > care.
> > > >
> > > > Problem is, sometimes the browser -does- care. There's not a
> > > difference
> > > > between "one character of whitespace" and "many characters of
> > > whitespace", but
> > > > there is a difference between those and "zero characters of
> > > whitespace".
> > >
> > > Agree. Also, HTML::Template is i think used in quite a wide range 
> > > of applications - and its not uncommon (at least at my workplace) 
> > > to encounter this templating mechanism to produce output for other 
> > > applications (eg, XML, CSV, TXT, ...) and sometimes those 
> > > applications do care about the number of whitespaces.
> > >
> > > >
> > > >
> > > > Me personally, I use an HTML::Template::Extension module to do 
> > > > it.
> > > Heck,
> > > > said module even appears to be appended to this email. Usage: 
> > > > use
> > > PACKTAGS
> > > > as an extension, and close some of your tags with " #>" (note 
> > > > the
> > > space)
> > > > instead of >. Any tags closed that way will cut off output until
> > > the next
> > > > tag in the template. (This could be trivially adjusted to just
> > > remove
> > > > whitespace, as well .. adjust _pack_tags in the obvious way).
> > > >
> > > > Incidentally, this script solves one of the two complaints I've 
> > > > had
> > > about
> > > > HTML::Template. The other complaint? There isn't a way to
> > > incrementally
> > > > render loops, since you have to give it the entire contents of 
> > > > the
> > > loop at
> > > > once. It seems silly to hold several thousand iterations of data 
> > > > in
> > > memory,
> > > > when one could just output an iteration at a time...
> > > >
> > > > Anyhoo. Enjoy.

--
Drew Taylor                | Web development & consulting
http://www.drewtaylor.com/ | perl/mod_perl/DBI/mysql/postgres
----------------------------------------------------------------------
Netflix: DVD Rentals by mail with NO late fees or due dates! Free Trial -
http://www.netflix.com/Default?mqso=36126240
----------------------------------------------------------------------


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to