[stringtemplate-interest] List-making problem
Mikael Nyberg
mikaeln at acm.org
Mon Dec 1 10:02:48 PST 2008
Oops, I apologize for omitting some crucial information regarding my
question above, the "top level" template I mentioned is of course not
a StringTemplate feature but simply an implementation detail in the
framework from which I use StringTemplate, where the attributes are
set using setAttributes(Map attrMap), and named templates with no
formal parameters are called.
So when attributes are set using a Map, and a parameterless template
test() is called, the following applies:
$if(name)$...$endif$ is legal, whether "name" is in the map or not
$[name:{whatever$it$}]$ is also legal. Yields empty list if "name" is
not in map.
$[{$name:{whatever$it$}$}]$ is not legal if name is not in the map.
Again, apologize for the confusion. What I'm trying to create is
pretty simple, just expressions like "and( someCrit, someOtherCrit,
filter( filterExpression) )", where "someCrit", "someOtherCrit" and
"filter(...)" are created by subtemplates, but only if certain
attributes exist in the parameter map. I.e. the expression may
collapse to "and(someCrit)" or even "and(filter(...))" or ideally just
"filter(...)".
More information about the stringtemplate-interest
mailing list