[stringtemplate-interest] Indirect attribute lookup

Terence Parr parrt at cs.usfca.edu
Sat Sep 6 16:44:17 PDT 2008


On Sep 6, 2008, at 3:03 PM, Roman Odaisky wrote:

> Hi,
>
>>> the idea was to be able to write
>>> $tag(id={some-id}, title={some-title})$
>>> and to get
>>> <tag id="some-id" title="some-title" />
>
>> Can you pass in a map instead of parameters directly?
>>
>> $foo(amap={...}, id=it)$
>>
>> the use $amap.(id)$ or somethign?
>
> First of all I wanted to simplify life for the template designer.  
> That is,
> he’d write $something:img(alt={photo}, width={42}, height={42})$ and  
> that
> would translate into obvious HTML.

I do that all the time...wait...what's the 'something' for?

> And my second concern was simplifying my life :-), because I ended  
> up writing
>
> $width:{width="$it$" }$$height:{height="$it$" }$...
>
> which is repetitive and not too entertaining.
>
> As you can see, there’s no map involved.

I used to do img templates all the time...what do you need indirection  
for?

Ter


More information about the stringtemplate-interest mailing list