Closed wookayin closed 10 years ago
Oops, I got a little mistake, the current syntax is not as above. I'll polish the issue later, sorry.
This is a good idea.
So the pipe behavior is like a sequential one right?
Like in ${X | Y | W}
I have a "X", feed into "Y" and resulting "Z", then "Z" is further
fed into W instead of X
?
How are you going to implement this? The behaviour is built in into the template engine.
Yeap, the lexer of jmte is hard-coded and seems to unconfigurable. What a pity :( AFAIK There is no way to apply multiple renderers in chain -- unless we fork and customize it.
BTW, do we indeed need the chaining? And I wonder why contest category renderer (#77) is included in the string
render. It is a parameterized thing, so what about split it into another renderer, as long as the other string filters are required for it. @vexorian please give your help and feedback for me. Thanks!
UPD1: I found a sample usage in 3e9b05b.
Yes, that actually is a good choice. We can split the contest
render apart from the string
. @vexorian What do you think?
Sorry I didn't notice this before.
contest category renderer is included in string
because lazyness.
I have been considering to make it whole renderer. It could also use more parameters too. Like separating TCO category by year.
Related to wiki page [[Template-Engine]], section Named Renderers.
I suggest that we change the syntax of named renderers in the template engine. Currently we have
and my suggestion is:
This is like a pipe semantic in unix shells. I think this is very intuitive and looks clear. Some other template engine syntax uses this style (they call them filter usually).
Well, of course, I know the previously defined templates are using the legacy style
{data;renderer}
. But the new greed can inintroduce this syntax, and we can keep backward compatibilities but encouraging use of the new style.Feedbacks are welcome. If acceptable, I'll submit a patch.
Just a note - related changes that can be followed:
${Contest.Name;string(contestcategory100)}
=>${Contest.Name | contestcategory(100)}