Preferred syntaxes are:
* FLUYT_X
* FLUYT_CC
* XML_ALIKE

Intact templates smart tool integration

By 'intact' I refer to templates, that can be used, just like their result. Java templates, that can be compiled into classes. And keep they java editors happy enough. Html pages, that can be shown in browsers, including working javaScript. Or can be edited with a visual editor. At least some of them. Those templates allow you to do quite a bit javaScript testing without the need to have the application running. But that requires some specific techniques, by the templating mechanism.

Mimicry

The term stems from biology and means an organism, that resembles some traits on another thing to gain som advantage. There are harmless animals that look dangerous like animals, or the dangerous fish looks like harmless stone. You name it.

Techniques, that allow our template code to integrate 'distraction free' into a host language, are called mimicry. In XML_ALIKE the region markup looks like an xml tag, in FLUYT_CC markup can be coated in comments.

Sourcecode example
Syntax integration
In some cases the template syntax is also a necessary part of host language. Like a location that's part of the method name:
public $Type$ get$Name$() { return $name$; }
That's the most compact approach, and take care, that our names are used consistently in the whole file.
Look alikes
With the right syntax we can have elements, that integrate well with the host language: FLUYT_X regions resemble xml or html tags in namespace t:
<t:products default="No Products found."> ... </t:products>
Here the IDE understands what tag needs to be closed.
Comment coating
If we hide some of the template code inside comments, we don't want to have those comments included in the results. That's why syntaxes like FLUYT_CC exist. This allows comment coating in order to hide Snippetory syntax in comment, and by this avoid distraction of the tools dealing with the surrounding language.
// $getters{ public $Type$ get$Name$() { return $name$; } // }$
The comment mark up is then considered part of the Snippetory markup and thus will be removed while binding the data.
Mock portions
When working with comment coating it might be helpful to define some placeholder, that vanishes during binding phase:
/*$type(*/int/*)*/
Backward Replace
But sometimes that value required is so specific, that not even comment coding will work in its own. The backward attribute relocates the target to the last occurrence of a regular expression before the original target:
resultset.getInt(i); // $type(backward='Int')
Randomly Select-able Syntax (RSS)
The switch-able syntax allows to select the syntax that best fits your actual needs at any point of the template. Especially the FLUYT_CC Syntax works well with javaScript, while FLUYT_X Syntax is optimized for html. If you have both in the same file, you might like to switch using the syntax selector.

Enjoy!

Bernd Ebertz Head, Founder and chief technology evangelist of
jproggy.org