Derick Rethans a écrit :
On Thu, 15 May 2008, Andreas Schamberger wrote
I found another template translation issue. With ezcTemplateNoContext
(and also in the HTML context) the newline after a translation block is
stripped. Is this the intended behavior? Would be annoying to add
additional newlines within email templates.
It's not a bug, because all blocks do this. However, I do agree that
it's unwanted behavior with the {tr} block - could you file an issue for
this please (as a bug)?
Sorry, I am probably missing something, but I always found this most
annoying in the eZP template language.
Outside of the HTML context, newlines are most likely quite important
(eg. for plaintext, mail bodies, csv, etc...).
I do not think that the newline following a template statement should
necessarily be eaten by the parser, but I think it is much more
important to preserve coherency: either those newlines are always
discarded, or they never are. Any other option makes the output of your
templates completely unpredictable. And the tr function is not different
from others. Why should the following then miss a newline between
caption and user comment?
{var $tr = "The user added the following comment:"}
{$tr}
{$action->comment}
What I heretofore propose is that
A - newlines always be preserved after the closing brace of a statement!
B - if this radical change is not welcome, an option is added, either as part
of the context object or separately, that decides on the fate of those pesky
newlines
C - no special provision is made for TR
D - a paragraph about this topic is added to the tutorial
The newlines problem is quite nasty with eZP tpl lang because there was no
possibility to leave enough whitespace/newlines in between the braces and the
included statement code. With the eZC version, if newlines after elements are
preserved, it is still possible (should be?)
to achieve the desired textual output and nicely aligned templates by using
spacing like this:
{ if $a
}{ var $tr = "The user added the following comment:"
}{$tr}
{$action->comment}
{ else
}{$alt_tr}
{ /if}
As a final note, how do you switch from html context to js one within
the same eZC template? Why is not a javascript context present by
default in the lib?
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components