Groovy Macro

The Groovy macro adds the ability to write Groovy scripts in wiki pages. This is a shortcut for Script Macro equivalent to {{script language="groovy"}} to execute Groovy scripts.

Usage

{{groovy}}
def list = ["one", "two"]
list.each { item ->
  println "* ${item}"
}
{{/groovy}}

Parameters

NameOptionalAllowed valuesDefault valueDescription
languageyesthe identifier of the JSR 223 engine Indicates which engine to use to execute the provided script. 
outputyestrue/falsetrueIndicates the output result has to be inserted back in the document.
wikiyestrue/falsetrueindicates if the result of the script execution has to be parsed by the current wiki parser. If not, it is put into a verbatim block.
jarsyescomma-separated list of JARs that will be added to the script execution class loadernone

Example

{{groovy}}
def list = ["one", "two"]
list.each { item ->
  println "* ${item}"
}
{{/groovy}}
Since context is a reserved binding in JSR-223 specifications used for scripting macros, the XWiki API Context is accessible through xcontext.

    

Search this space