...
Template Language
The template language necessity need appeared in early versions of SIL. Creating real mail templates was not very easy, and the SIL programmer had to resort to all kind of artificial constructs for that. Especially, repetitive constructs were hard to embed in the body of the mail, and they needed to be built in the script before inserting them into the mail, with all necessary escapes, making the process of sending that mail cluttered.
...
- Template is provided by the user. Within it, the The user writes embedded code within it.
- The code is translated into a fully executable SIL script, buffered in memory.
- The SIL interpreter is called on the given script; the . The script is executed and the result is gathered in a special area, in memory.
- The result is retrieved and used wherever is needed.
As you can see, the The technique is resembling the JSP (Java Server Pages) technique, so it's nothing exciting.
Syntax
The syntax used is backward compatible with the previous versions of templates, so you can expand the use of STL immediately over your old templates.
...
An example is represented below:
Code Block | ||
---|---|---|
| ||
<html> <body> Hello $reporter$ from $custName$, the sender $sender$ announces you that the assignee for issue $key$ is $assignee$ and that work has started $! //this is a simple script, not carrying too much meaning, but just used as an example. for(number i = 0; i < 3; i++) { $ <p> Hooray! </p> $! } $ </body> </html> |
...