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.

    

Related Pages

Search this space

 

Most popular tags

Failed to execute the [groovy] macro
  1. access rights
  2. activity stream
  3. annotation
  4. attachment
  5. comment
  6. Document Tree Macro
  7. export
  8. Extension Manager
  9. Flamingo skin
  10. global user
  11. Groovy event listener
  12. group
  13. nested page
  14. search
  15. skin
  16. syntax
  17. user
  18. user profile
  19. velocity macros
  20. wiki
  21. wysiwyg
  22. XWiki Applications
  23. xwikiattachment_archive table
  24. xwikiattachment table
  25. xwikiattrecyclebin table
  26. xwikiproperties table

[Display all tags from this space]