[stringtemplate-interest] format option implementation details
Terence Parr
parrt at cs.usfca.edu
Sun Dec 10 13:43:02 PST 2006
On Dec 10, 2006, at 12:34 PM, John Snyders wrote:
>>> 2) if the renderer is associated with type String then it is
>>> possible for the value of an attribute to be rendered twice. This
>>> will only happen if the format is applied to a template rather than
>>> an attribute.It happens because the String attribute is rendered
>>> and written as part of the value of the template expansion then the
>>> format is applied to the String value of the template. Now that I
>>> think of this more it may be a bug. I'll look into it.
>>
>> Just an efficiency thing.
>
> Not just efficiency. I depends on if your rendering is idempotent.
> I had a renderer that escaped quotes " --> \". Now I end up with \\"
So if you have "a $it$ b"; format="f" and $it$ is a String object
with its own renderer you get renderer applied to $it$ object and
then you apply format to the toString() version of the entire
template? Seems ok unless, as you say, you are escaping things.
But, that is operator error as you don't want to escape templates
only attributes I'd say.
Ter
More information about the stringtemplate-interest
mailing list