[stringtemplate-interest] Using the "format" option with a template calls
Udo Borkowski
ub at abego-software.de
Tue Jan 25 00:56:37 PST 2011
While the "format" option work fine with attributes, like in
<attr;format="upper">
it does not seem to work when used together with template invocations, like:
<t();format="upper">
I don't know if this is intended (e.g. because of performance reasons) or a bug. I personally would like to have the format option also work in the latter situation. E.g. when I "refactor" my templates it happens data once stored in an attribute moves into a template. This was not possible when the "format" option is used.
I am currently working around this by using a custom ObjectModelAdapter for ST, using this code:
public Object getProperty(ST self, Object o, Object property,
String propertyName) throws STNoSuchPropertyException {
if ("render".equals(propertyName) && (o instanceof ST)) {
return ((ST) o).render();
}
return super.getProperty(self, o, property, propertyName);
}
This way the above example looks like this:
<t().render;format="upper">
While this works fine I am still wondering if the "format" options should also work for the simple template call, too.
What do you think?
Udo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110125/81f2fcca/attachment.html
More information about the stringtemplate-interest
mailing list