POST_ and PRE_CHOMP?

Christian Robottom Reis kiko at async.com.br
Wed Nov 5 00:03:31 UTC 2003


On Sat, Nov 01, 2003 at 10:13:36PM +0000, Gervase Markham wrote:
> Christian Robottom Reis wrote:
> >Why are our templates PRE_CHOMP by default? It's a lot more tricky for
> >lines that end in template commands, isn't it?
> 
> When we initially wrote the first templates, we did some experimenting. 
> We wrote some templates in the style we wanted to use, and then tried 
> PRE, POST, both and neither to see which produced the nicer-looking 
> HTML. The answer was PRE.

Well, if I understand *_CHOMP correctly, both seem to be a serious
gotcha when writing a template, so correct me if I'm wrong:

    POST_CHOMP will bite you if you have something like:

        foo bar [% noogie %]
        baz

    ramming the value of noogie into baz.


    PRE_CHOMP will bite you if you have something like:

        Foo bar baz
        [% noogie %]

    ramming baz into the content of noogie.

> Turning both on makes it all one line (basically), and having none 
> leaves too much whitespace and general ugliness. All of the current 
> templates are written such that PRE does the right thing - I don't think 
>  we can change it now.

I recently reviewing a patch by Josh that fixed a problem that resulted
from PRE_CHOMP eating up whitespace in an error message:

    http://bugzilla.mozilla.org/show_bug.cgi?id=217219

The line in question was:

    -    <tt>[% prod FILTER html %]</tt> product, but you are trying to use
    -    [% votes FILTER html %].

which (AIUI) rammed votes into "use". Is this expected?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331



More information about the developers mailing list