Versions Compared

Key

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

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

Contents

Table of Contents

Template Language

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 technique is resembling the JSP (Java Server Pages) technique.

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.

 


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: 

Code Block
titleSTL Example
<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> 

How To Use Them

The scripting usage is simple. You can use STL to create template emails or directly in your programs you may call the executeTemplate() routine to parse and execute a template.

...

Child pages (Children Display)
excerpttrue
excerptTypesimple

How Do I Edit Templates ?

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 


For The Technical Minded

In the backstage, SIL defines 3 internal routines:

...

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.

...