Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added table of contents

...

Version 2.2, June 15, 2006

Related material:

...

Contents

Related material

Please see the changes and bugs page. That page generally discusses the Java version of StringTemplate but, some of the information it contains might apply to other implementations.

...

Java

TestStringTemplate.java

C#

TestStringTemplate.cs

Python

TestStringTemplate.py

Additionally, it It is highly recommended that you read the (academically-oriented) paper, Enforcing Model-View Separation in Template Engines. There are some more examples including nested menu generation that will be of interest. You may also find the following resources useful or interesting:

Introduction

Most programs that emit source code or other text output are unstructured blobs of generation logic interspersed with print statements. The primary reason is the lack of suitable tools and formalisms. The proper formalism is that of an output grammar because you are not generating random characters--you are generating sentences in an output language. This is analogous to using a grammar to describe the structure of input sentences. Rather than building a parser by hand, most programmers will use a parser generator. Similarly, we need some form of unparser generator to generate text. The most convenient manifestation of the output grammar is a template engine such as StringTemplate.

...