A StringTemplate group file is a collection of templates stored within a single file. The ANTLR project on GitHub contains many examples; e.g. Java.stg which contains all of the code generation templates for the Java target for ANTLR 4.
You can find several examples for using StringTemplate 3 in C# in the StringTemplateTests.cs file from the StringTemplate C# project itself. It's not the most friendly documentation, but it does include examples covering a wide range of ST3 features. Here is one example using StringTemplateGroup
:
string templates =
"group dork;" + newline +
"" + newline +
"test(name) ::= <<" +
"<(name)()>" + newline +
">>" + newline +
"first() ::= \"the first\"" + newline +
"second() ::= \"the second\"" + newline
;
StringTemplateGroup group =
new StringTemplateGroup( new StringReader( templates ) );
StringTemplate f = group.GetInstanceOf( "test" );
f.SetAttribute( "name", "first" );
string expecting = "the first";
Assert.AreEqual( expecting, f.ToString() );
So it's easier to read, the template group file code into that test looks like this without the escape characters.
group dork;
test(name) ::= <<<(name)()>
>>
first() ::= "the first"
second() ::= "the second"