StringTemplate is a very simple and powerful template engine. The existing documents are fairly complete. As long as one knows where to find those documents, learning StringTemplate is quite easy. This note is intended to help users to quickly find needed documents.
To learn StringTemplate means to learn the following three aspects of it:
- The core concepts and the relationship among them
- Syntax of templates and template groups
- API
In this document, users can find:
- A brief introduction to StringTemplate 4
- Instructions to setup Java programs to use StringTemplate 4
- Syntax of templates and groups
- StringTemplate 4 Java API
The syntax documentation is quite formal and is in (a variation of?) the Backus-Naur Form notation. Programmers who are not used to such formal notation may feel that the syntax documentation is hard to understand. For those programmers, my recommendation is to spend one hour to learn the Backus-Naur Form notation. Of course, examples also help.
This article from the creator of StringTemplate provides:
- An overview of StringTemplate
- The philosophy of StringTemplate
- The theoretical foundation of StringTemplate
- A few examples showing the main features of StringTemplate, namely:
- attribute (and attribute property) reference
- map operation (i.e. applying a template to an attribute that is a list of objects or applying a list of templates alternatively to an attribute that is a list of objects),
- conditional include
- recursive template.
In this article by the creator of StringTemplate, the author provides a comprehensive introduction, explaining the major concepts in StringTemplate with examples:
- Template
- Template group
- Expression
- Attribute
- Multi-valued attribute
- Implicitly set attribute
- Template include
- Conditional include
- Template application, to a single or multiple attributes
- Anonymous inline template
- Recursive template
- Group inheritance and overriding
- Template region
- Group interface
- Map (dictionary) and list
- Renderer
No comments:
Post a Comment