[stringtemplate-interest] Region Syntax

Terence Parr parrt at cs.usfca.edu
Wed Oct 10 13:59:40 PDT 2007


On Sep 25, 2007, at 5:52 PM, Andrew Hallock wrote:

> Hi Terrance,
>
> > Set @page_title in a subgroup.  Joy shall be yours. :)
>
> So close, but no joy was had :)
>
> I had a subgroup overriding the layout regions as you mention -  
> works fine - but I want to add attributes that are not part of the  
> formal argument list on the parent group, since the subgroup  
> overriding region has its own context and its own idea of what it  
> wants to override with.
>
> group layout;
> main_layout() ::= <<
> <html>
> <head>
> <title>
> $@page_title()$
> </title>
> </head>
> <body>
> $@child_content()$
> </body>
> </html>
> >>
>
> I want to override the child_content region in a subgroup, but also  
> supply new attributes based on what page the user is requesting.
>
> In code, I use StringTemplate.FormalArguments.Add() to get around  
> this, but I don't know if this is correct behavior.

  interesting.  Well, because of the dynamic scoping, the overridden  
subregion will only see the attributes of the enclosing template.   
Have you tried passing an argument like @child_content(page="foo")?

Ter


More information about the stringtemplate-interest mailing list