...
- change the imports to the new package for ST
- change the members of a rules return scope to use ST not StringTemplate. Also change toString() method to call render.
- we need a blank library of templates to avoid a null pointer if someone forgets to set the library. change:
Code Block |
---|
protected StringTemplateGroup templateLib =
new StringTemplateGroup("<name>Templates", AngleBracketTemplateLexer.class);
|
to Code Block |
---|
protected STGroup templateLib = new STGroup();
|
- get rid of the definition of STAttrMap altogether; we don't need it anymore because ST.add() it allows us to chain calls to add multiple attributes as part of a single expression.
- the previous item lets us convert:
Code Block |
---|
rewriteExternalTemplate(name,args) ::= <<
templateLib.getInstanceOf("<name>"<if(args)>,
new STAttrMap()<args:{a | .put("<a.name>", <a.value>)}>
<endif>)
>>
|
to Code Block |
---|
rewriteExternalTemplate(name,args) ::= <<
templateLib.getInstanceOf("<name>")
<if(args)><args:{a | .add("<a.name>", <a.value>)}><endif>
>>
|
There are three methods like that.
If you look at an ST.stg difference, there's not much to do.