Groovy Macro

Version 16.1 by Thomas Mortagne on 2011/10/27 19:24

cogAdds ability to write scripts in Groovy in wiki pages
Typejavamacro
Category
Developed byUnknown
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

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 definition

See the Script Macro for details.

Example

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

Result

  • one
  • two

Note that since context is a reserved binding in JSR-223 specifications used for Scripting Macros, the XWiki Api Context is now accessible throught xcontext

Tags: groovy script
    

Get Connected