Chapter 3. Velocity Template Language

Table of Contents

The Velocity Template Language (VTL) is used to embed dynamic elements within what would otherwise be static templates. By using VTL it is possible to interact with the user, calculate values, incorporate conditional logic, and much more.

References

Dynamic content is embedded in a template file using references . VTL supports three types of references:

  • variables

  • properties

  • methods

References in Velocity are always treated as String objects.

jEdit-Specific Variables

Several "special" variable are added by the Templates plugin into the Velocity context, and are available for use by plugins. This section describes these jEdit-specific variables.

"buffer" variable

This variable can be used to obtain a handle to the current jEdit buffer.

"textarea" variable

This variable can be used to obtain a handle to the current jEdit textarea.

"view" variable

This variable can be used to obtain a handle to the current jEdit view.

"_jeditIndentation" variable

This variable can be used to indent the current line, based on the indentation values configured for the current buffer.

"_jeditTab" variable

This variable can be used to insert a tab into the current buffer. The tab may be a soft or hard tab, depending on the buffer configuration.

"_jeditSelection" variable

This variable will contain any text in the current buffer which was selected at the time the template began processing.