[stringtemplate-interest] StringTemplate extensions
Luis Leal
luisl at scarab.co.za
Sun Jan 8 00:28:49 PST 2006
Hi,
I've never needed "reverse", but I can see that it would be useful. I'd go
for <reverse(arg):{a|<a.type> <a.name>;}> - prefer the consistency.
Not sure what the use case was for "repeat" in the original post. I have
however needed to process items in a collection multiple times - mainly to
generate copies of pages when using StringTemplate to generate a PDF. It
doesn't seem optimal / elegant to have to modify the model just to process
items more than once? Maybe something like this?
$collection:{
$loopcounter:{
}$
}$
where loopcounter could be an attribute or a literal.
Luis
--- Cut ---
Interesting...could be useful. I'm not opposed, but can anybody else
comment on the need? They certainly don't break the "rules".
I'm thinking that perhaps a more functional approach is what we want
for the order:
<args:{a|<a.type> <a.name>;}>
does them in order and to reverse, perhaps
<args:reverse():{a|<a.type> <a.name>;}>
or to be consistent with first(), rest() built-in functions,
<reverse(arg):{a|<a.type> <a.name>;}>
This one makes sense, right?
As for repeat, seems an option is the best
<"0"; repeat="20">
or
<initvalue; repeat="20">
Hmm...I'm uncomfortable with the notation a bit, but separator and
repeat seem similar enough to warrant another option. Actually, you
are probably asking for this:
<initvalue; repeat="<n>">
or is it
<initvalue; repeat=n>
where n is an attribute saying how many times to do something.
Hmm...now my model-view separation alarm is going off. Hmm...
--- Cut ---
More information about the stringtemplate-interest
mailing list