...
java | Code Block |
---|
import org.antlr.stringtemplate.*;
import org.antlr.stringtemplate.language.*;
StringTemplateGroup group = new StringTemplateGroup("myGroup", "C:\\Tutorials", DefaultTemplateLexer.class);
StringTemplate helloAgain = group.getInstanceOf("homepage");
helloAgain.setAttribute("title", "Welcome To StringTemplate");
helloAgain.setAttribute("name", "World");
helloAgain.setAttribute("friends", "Ter");
helloAgain.setAttribute("friends", "Kunle");
helloAgain.setAttribute("friends", "Micheal");
helloAgain.setAttribute("friends", "Marq");
System.out.println(helloAgain.toString());
|
|
---|
C# | Code Block |
---|
using System;
using Antlr.StringTemplate;
using Antlr.StringTemplate.Language;
StringTemplateGroup group = new StringTemplateGroup("myGroup", @"C:\Tutorials", typeof(DefaultTemplateLexer));
StringTemplate helloAgain = group.GetInstanceOf("homepage");
helloAgain.SetAttribute("title", "Welcome To StringTemplate");
helloAgain.SetAttribute("name", "World");
helloAgain.SetAttribute("friends", "Terence");
helloAgain.SetAttribute("friends", "Kunle");
helloAgain.SetAttribute("friends", "Micheal");
helloAgain.SetAttribute("friends", "Marq");
Console.Out.WriteLine(helloAgain.ToString());
|
|
---|
Python | Code Block |
---|
import stringtemplate
group = stringtemplate.StringTemplateGroup("myGroup", "C:\\Tutorials")
helloAgain = group.getInstanceOf("homepage")
helloAgain["title"] = "Welcome To StringTemplate"
helloAgain["name"] = "World"
helloAgain["friends"] = "Terence"
helloAgain["friends"] = "Kunle"
helloAgain["friends"] = "Micheal"
helloAgain["friends"] = "Marq"
print str(helloAgain)
|
|
---|
Python 3 | Code Block |
---|
import stringtemplate3
group = stringtemplate3.StringTemplateGroup("myGroup", "C:\\Tutorials")
helloAgain = group.getInstanceOf("homepage")
helloAgain["title"] = "Welcome To StringTemplate"
helloAgain["name"] = "World"
helloAgain["friends"] = "Terence"
helloAgain["friends"] = "Kunle"
helloAgain["friends"] = "Micheal"
helloAgain["friends"] = "Marq"
print(str(helloAgain))
|
|
---|
What next?
Read the StringTemplate Documentation
...