cogAdds ability to write scripts in Groovy in wiki pages
TypeJAR
Developed by

XWiki Development Team

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Enterprise, XWiki Enterprise Manager

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

If Groovy script is not supposed to produce any output, for example, Groovy Class with just parameters is defined, declare  macro as:

{{groovy output="false"}}

See 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
Created by Thomas Mortagne on 2008/12/02 14:52
    

Get Connected