Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The template language need appeared in early versions of SILSIL™. Creating real mail templates was not very easy, and the SIL 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.

The first step in creating a real template language was done with the (unpublished) app SIL SIL™ on-the-fly Reporter, at version 3.x. However, this initial development was aimed at that app only, and in version 4.x a substantial effort has been employed to put STL at the base of the apps, near SIL SIL™ so it can be used from all the places and all apps.

That being said, STL (SIL Template Language) should not be confounded with C++ STL (Standard Template Library). They are different beasts.

How It Works 

 


The idea of the STL is simple:

  1. Template is provided by the user. The user writes embedded code within it.
  2. The code is translated into a fully executable SIL SIL™ script, buffered in memory.
  3. The SIL interpreter is called on the given script. The script is executed and the result is gathered in a special area, in memory.
  4. The result is retrieved and used wherever is needed.

...

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. 


Token(s)
Explanation
STL Example
$!expression$Translates the expression into SIL exactly as it is$!for (number i = 0; i<o; i++) $
$output$outputs the string expression in the result$assignee$
\$the $ character ($ needs to be escaped now)\$

...


An example is represented below: 

...

You can access your templates from the SIL Manager page, by selecting the Kepler Home tree view:

 


Note

As of now, the SIL Manager does not have proper support for checking the STL syntax. We're working on it, but it may take a while 

...

The STL generator keeps track of the line numbers so it can report back errors in the template, and not in the translated SIL SIL™ unit.

Execution appends the result of the print statements in a buffer kept as a local execution variable in the SIL context, so once the script has finished, the unnecessary is ready to be collected. 

Info

In fact, STL is pluggable and doesn't depend on these exact symbols. The generator can use different separators and different routine names. However, the bridge between STL and SIL SIL™ have defined them as stated above.

...