Wizard Engine Service

Revision as of 14:14, 17 October 2008 by Paulb (Talk | contribs) (Template Files)

The Wizard Engine Service is currently in it's nascency but provides a full template rendering engine for consuming tokenized templates (either from files or in-memory) and rendering them using a variable table. The results are just as flexible as the consumption, the rendered text may be generated into a in-memory representation or stored into a file.

The service makes use of an internal core engine called the Code Templates Engine, which performs actual rendering and is vastly more structured and verbose to work with. This same engine is also used by the Code Templates Catalog Service, ensuring all manner of templates are defined and rendered in the same fashion though out EiffelStudio. The purpose of the Wizard Engine Service is to facilitate quick and easy translation of code templates without the overhead involved when using the Code Template Engine directly.

Template Files

Template files are simple files tokenized with variable declarations. The variables will be expanded with those specified in a table passed to the service's rendering functions.

A variable is tokenized with a $ specified followed by an Eiffel-like identifier. By convention all variables are specified in uppercase characters in the template. Variables are not actual case-sensitive so this is by convention only. For example, here is the simplest form of a variable declaration:

$VARIABLE_NAME

When inserting variables adjacent to template text the variable declaration name may be blurred. To be more explicit with variable declarations, wrapped the variable name in curly braces ({...}). The token specifier $ must remain before the opening {:

${VARIABLE_NAME}

Due to the special meaning of $ it might be necessary to escape it to use in the template text itself. To escape the token specifier use $$, which will be expanded (or shrunk) to $ in the rendered template.

Common Locations

When working with templates in EiffelStudio, most templates are located under a common template folder, in the EiffelStudio installation.

If using template files, and installing the template files under the EiffelStudio templates folder, you are encouraged to support User Replaceable Files, so end-users are free to redefine the templates in their own way. Extra precaution needs to be taken however because user files are more susceptible to changes and updates which may result in erroneous rendering.