Template Control Language (TCL)

Template Elements

Templates might consist of 6 different elements:
Text
Elements of the effective "Output Language". Text-Elements don't have to be marked. As long as a Template-Element is not otherwise marked, it will be automatically interpreted as Text-Element.
Comments
Template Comments will be ignored in the further processing.
Code
Templet Code (Java), to be executed in the Templet's execute-method.
Expressions
Runtime Replacement, to be resolved at Templet's Execution.
Evaluations
Parsing Time Replacement, to be resolved at Templet's Generation.
Statements
Macro calls, that create all other elements and can execute other "invisible" commands.
See also: TCL Demo 1

Tags und Styles

Elements are marked resp. identified by Tags. Those Tags are defined in Styles. Styles can be loaded via
  • the definition of a TemplateLanguage as obligatory language specific Default Style or
  • the BuildIn-Macro style in a template.
The Template Elements are supported by the following tags:

Comments

Comments can be used to document the Template. They will ignored in the further processing.
Line Comment
A Line Comment starts with the Line Comment Tag and ends at the end of the line ('_').

Syntax (Core Style):
{#$my comment_
Block Comment
A Block Comment starts with the Block Comment Start Tag and ends with the Block Comment End Tag.

Syntax (Core Style):
[#$my comment$#]
Syntax (JSP):
<%--my comment--%>

Code

Code is Java code to be generated directly in the Templet's execute-method.
Line Code
A Line Code starts with the Line Code Tag and ends with the end of the line ('_').

Syntax (Core Style):
{c$my java code_
Block Code
A Block Code starts with the Block Code Start Tag and ends with the Block Code End Tag.

Syntax (Core Style):
[c$my java code$c]
Syntax (JSP):
<% my java code%>

Expression

An Expression is an unary Java expression to be evaluated at the Templet's runtime; i.e. on generation of the final output.
An Expression starts with the Expression Start Tag and ends with the Expression End Tag. java.lang.String.valueOf(my expression) has to be a valid Java expression.

Syntax (Core Style):
[$my expression$]
Syntax (JSP):
<%=my expression%>

Evaluation

An Evaluation is replaced at the template's parsing time. Currently, only replacement of Properties is implemented.
Propertyevaluation
A Property Evaluation starts with the Property Evaluation Start Tag and ends with the Property Evaluation End Tag. [p$my property$p] is replaced with my value by the Template Compiler.

Syntax (Core Style):
[p$my property$p]

Statement

Statements are the central and most powerfull control elements. The consists of a Macro-Call.
Line Statement
A Line Statement starts with the Line Statement Tag and ends with the end of the line ('_').

Syntax (Core Style):
{m$my macro call_
Block Statement
A Block Statement starts with the Block Statement Start Tag and ends with the Block Statement End Tag.

Syntax (Core Style):
[m$my macro call$m]
Syntax (JSP):
<%my macro call%>