XWiki Syntax Guide

Last modified by Thomas Mortagne on 2014/05/07 16:06

XWiki Syntax 2.1 ยป Programming

XWiki Syntax 2.1: Programming

Macros

2.0 Macros

There is only one kind of macro in XWiki Syntax 2.1, which is called by the syntax: {{macroname param1="value1" ... paramN="valueN"}}

FeatureXWiki Syntax 2.1Result
Rendering Macro
{{code language="java"}}
System.out.println("Hello World!");
{{/code}
System.out.println("Hello World!");
IconInformation

Radeox macros cannot be used in XWiki Syntax 2.1. Thus they have been rewritten as Rendering macros.

IconInformation

For the full list of available macros check the Extensions wiki.

HTML

2.0 HTML

IconInformation

In XWiki Syntax 2.1 HTML or XHTML must be entered by using the HTML macro.

XWiki Syntax 2.1Result
{{html}}<b>bold</b>{{/html}}bold
IconInformation

In XWiki Syntax 2.1, by default the HTML macro does not understands XWiki Syntax (other macros included since it's XWiki Syntax too). To enable it, use {{html wiki="true"}}.

Scripts

2.0 Scripts

IconInformation

In XWiki Syntax 1.0 it was possible to enter Velocity scripts anywhere directly in the page. This lead to issues for example when the user was involuntarily entering Velocity content. It was also performance hungry for pages not requiring Velocity content. There were several other technical limitations. Thus in XWiki Syntax 2.1 Velocity scripts must be entered using the velocity macro. Same goes for entering Groovy scripts.

FeatureXWiki Syntax 2.1
Velocity script
{{velocity}}
#set ($var = "whatever")
{{/velocity}}
Groovy script
{{groovy}}
def var = "whatever"
{{/groovy}}