Extensions Wiki » Extensions » Velocity Macro

Velocity Macro

Last modified by Thomas Mortagne on 2013/03/14 14:27
cogExecutes a Velocity script and apply current page parser on the result
TypeJAR
Developed by

XWiki Development Team

LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Enterprise, XWiki Enterprise Manager

Description

Usage

See example below

Note that the velocity script is executed before anything else so if you put an xwiki 2.0 "include" inside the "velocity" macro you will not be able to use any velocity macro/variable defined in the included page because the include is done after the velocity is executed. Take care of putting include macro outside of velocity macro.

Parameters definition

Velocity macro extends Script Macro and support all its parameters (except the language selection which is always velocity).

Following are Velocity macro specific parameters:

NameOptionalAllowed valuesDefault valueDescription
filteryesnone/html/indentindentIndicate a filter to apply on velocity content before and after script execution. The default filter (indent) remove all first whites spaces of lines to support code indentation. See Velocity Macro Filter for more details.
outputyestrue/falsetrueIndicate that the resulting output will be inserted back into the document.
wikiyestrue/falsetrueIndicate if the result of the script execution has to be parsed by the current wiki parser. If not, it's parsed as plain text.

Example

{{velocity}}
#set($words = ["Some", "velocity", "code"])
#foreach($word in $words)
  $word ##
#end
{{/velocity}}

Result

Some velocity code

Created by Thomas Mortagne on 2008/09/30 12:57

Download XWiki