Migration Guide from XWiki Syntax 1.0 to XWiki Syntax 2.0

Migration Guide from XWiki Syntax 1.0 to XWiki Syntax 2.0

Start by reading the differences between the two syntaxes in the Syntax Reference Guide.

Migrate new lines

  • In XWiki Syntax 1.0 new lines were not taken into account. They now are. So if you want to keep the text on the same line you'll need to remove your new lines.
For example
This is
on one line

becomes

This is on one line

  • Replace [...] with double brackets: [[...]]

Migrate Headers

  • Replace 1.1+ syntax with equal signs: ==+

Migrate Velocity scripts

  • Surround Velocity code with the velocity macro.
  • Replace calls to #include* with the include macro. Use context="current" for executing in the current page context.
Warning: The page you're including must also be transformed into 2.0 Syntax for the include to work properly.

For example:

1 Latest Articles

#set($nbstart = $request.nbstart)
#set($category = "")
#set($nbitems = "10")
#includeMacros("Blog.Macros")

becomes:

= Latest Articles

{{velocity}}
#set($nbstart = $request.nbstart)
#set($category = "")
#set($nbitems = "10")
{{/velocity}}

{{include document="Blog.Macros" context="current"/}}

Warning: The Blog.Macros page also needs to be modified to be written in Syntax 2.0 or otherwise the include will not generate the result you want...

Migrate HTML

  • Surround all HTML blocks with the html macro.
Warning: The HTML must be XHTML. Otherwise use the html macro.
Warning: If you have both Velocity and HTML mixed you should use the following construct
{{velocity}}{{html}}...{{/html}}{{/velocity}}

For example:

1.1 Add an Article

<form action="" id="newdoc" method="post">
<div>
<input type="hidden" name="parent" value="Main.WebHome" />
<input type="hidden" name="template" value="XWiki.ArticleClassTemplate" />
<input type="hidden" name="sheet" value="1" />
<input type="hidden" name="webname" value="Main"/>
<input type="hidden" name="name" value=""/>
<input type="text" name="title" value="page name" size="18"/>
<input type="button" value="Add" onclick='if (updateName(this.form.title,this.form.name)) { action="../../inline/" + this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }' />
</div>
</form>

becomes

== Add an Article

{{html}}
<form action="" id="newdoc" method="post">
<div>
<input type="hidden" name="parent" value="Main.WebHome" />
<input type="hidden" name="template" value="XWiki.ArticleClassTemplate" />
<input type="hidden" name="sheet" value="1" />
<input type="hidden" name="webname" value="Main"/>
<input type="hidden" name="name" value=""/>
<input type="text" name="title" value="page name" size="18"/>
<input type="button" value="Add" onclick='if (updateName(this.form.title,this.form.name)) { action="../../inline/" + this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }' />
</div>
</form>
{{/html}}
Tags:
Created by Vincent Massol on 2008/09/16 14:32
Last modified by Lucien Pereira on 2009/07/23 20:31

This wiki is licensed under a Creative Commons license
2.2.1.27354