Velocity Macro

This is a XWiki macro, bundled with all the XWiki products by default.
Macro developed by the XWiki Development Team.
This macro cannot currently be downloaded separately.

Velocity Macro

Executes a Velocity script and apply current page parser on the result.

Usage

See example bellow

Warning: 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

NameOptionalAllowed valuesDefault valueDescription
outputyestrue/falsetrueIndicate if the macro should print something or not
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.

Example

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

Result

Some velocity code

Tags:
Created by Thomas Mortagne on 2008/09/30 12:57
Last modified by Sergiu Dumitriu on 2010/02/23 10:57

This wiki is licensed under a Creative Commons license
2.2.1.27354