Wiki source code of XWiki Syntaxes

Last modified by Administrator on 2010/03/20 15:46

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}{{toc depth="1"/}}{{/box}}
2
3 Starting with XWiki Enterprise version 1.7 and above we've introduced a new wiki syntax. So we're now naming the current syntax the //XWiki Syntax v1.0// and the new syntax is logically called the //XWiki Syntax v2.0//. The main reasons for introducing the new syntax were:
4 * Fix the limitations and ambiguities of the XWiki 1.0 syntax (which was inspired by both Radeox - the underlying rendering engine - and TWiki).
5 ** Not optimal symbols. For example the symbol for bold was single stars. This was causing trouble when users were entering text containing stars since that text was mistakenly considered to be bold when it wasn't. Hence we've rationalized the syntax by using at least double characters everywhere.
6 ** Ambiguities. For example there was an ambiguity between a bold item starting a line and a bulletted list. Resolving the ambiguities was required in order to rewrite the WYSIWYG editor so that it could be deterministic.
7 * Be closer to the [[Creole 1.0 syntax>>http://www.wikicreole.org/]] which is becoming a standard for wiki syntax. In addition the Creole community has taken the time to analyze all the existing wiki syntaxes before deciding on symbols. The choices made are thus very good.
8
9 In addition to these 2 XWiki syntaxes we've also changed our underlying rendering engine (was Radeox previously) in favor of our own engine which is superset wrapper around [[Wikimodel>>http://code.google.com/p/wikimodel/]] and [[Doxia>>http://maven.apache.org/doxia/]] (and possibly others in the future). This has allowed us to provide other syntaxes in the wiki: [[MediaWiki, Confluence, JSPWiki, Creole, TWiki and more>>#syntaxes]]
10
11 = General Remarks =
12
13 XWiki Syntax v2.0 corrects some errors or ambiguous syntax entered by the user as shown in the examples in the table below.
14
15 |=Description|=Example of invalid or ambiguous syntax|=Fixed XWiki Syntax 2.0
16 |Not closed tet styles|{{{**bold}}}|{{{**bold**}}}
17 |Two standalone elements not separated by 2 new lines|{{{| table cell}}}\\{{{* list item}}}|{{{| table cell}}}\\\\{{{* list item}}}
18 |Two standalone elements not separated by 2 new lines|{{{paragraph}}}\\{{{----}}}\\{{{paragraph}}}|{{{paragraph}}}\\\\{{{----}}}\\\\{{{paragraph}}}
19 |Ignored new line at beginning of document|<new line at beginning of document>\\paragraph|paragraph
20 |Not closed header syntax|{{{=== header}}}|{{{=== header ===}}}
21
22 = Paragraphs =
23
24 Paragraphs are text elements separated by 2 or more new lines.
25
26 {{info}}
27 In XWiki Syntax 2.0 new lines are honored which is not the case in XWiki Syntax 1.0 and in Creole syntax.
28 {{/info}}
29
30 (% style="width:100%" %)
31 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 1.2
32 |Simple paragraph|This is a paragraph|This is a paragraph|This is a paragraph|This is a paragraph
33 |Paragraph on multiple lines|Paragraph on{{{\\}}}\\multiple lines|Paragraph on\\multiple lines|Paragraph on\\multiple lines|Paragraph on\\multiple lines
34 |Two paragraphs|Paragraph one\\\\Paragraph two|Paragraph one\\\\Paragraph two|Paragraph one\\\\Paragraph two|Paragraph one\\\\Paragraph two
35 |Parametrized paragraph|<p style="text-align:center;color:blue">Centered and blue paragraph</p>|{{{(% style="text-align:center;color:blue" %)}}}\\Centered and blue paragraph|(% style="text-align:center;color:blue" %)\\Centered and blue paragraph|(% style="text-align:center;color:blue" %)\\Centered and blue paragraph
36
37 = Headers =
38
39 (% style="width:100%" %)
40 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
41 |Standard headers|(((
42 1 level 1
43 1.1 level 2
44 1.1.1 level 3
45 1.1.1.1 level 4
46 1.1.1.1.1 level 5
47 1.1.1.1.1.1 level 6
48 )))|((({{{
49 = level 1 =
50 == level 2 ==
51 === level 3 ===
52 ==== level 4 ====
53 ===== level 5 =====
54 ====== level 6 ======
55 }}})))|(((
56 {{html}}
57 <!-- Note: replace this with wiki syntax when http://jira.xwiki.org/jira/browse/XWIKI-4358 is implemented -->
58 <h1 id="Hlevel1"><span>level 1</span></h1><p>&nbsp;</p><h2 id="Hlevel2"><span>level 2</span></h2><h3 id="Hlevel3"><span>level 3</span></h3><h4 id="Hlevel4"><span>level 4</span></h4><h5 id="Hlevel5"><span>level 5</span></h5><h6 id="Hlevel6"><span>level 6</span></h6>
59 {{/html}}
60 )))
61 |Parametrized headers|<h1><span style="color:blue">header</span></h1>|{{{(% style="color:blue" %)}}}\\= header =|(((
62 {{html}}
63 <h1 id="Hheader" style="color:blue"><span>header</span></h1>
64 {{/html}}
65 )))
66 |Headers with wiki syntax|1.1.1 Header with *bold*|{{{=== Header with **bold** ===}}}|(((=== Header with **bold** ===)))
67
68 = Text Formatting =
69
70 {{info}}
71 New in XWiki Syntax 2.0 over XWiki Syntax 1.0:
72 * Spaces are allowed just after the syntax symbols (for example in XWiki Syntax 1.0, this was not * bold *).
73 * Use double symbols when there was only a single symbol in XWiki Syntax 1.0 so that it's less likely that the user will mistakenly use them in text.
74 * Ability to span several lines (wasn't the case in XWiki Syntax 1.0).
75 {{/info}}
76
77 (% style="width:100%" %)
78 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
79 |Bold|{{{*bold*}}}|{{{**bold**}}}|**bold**
80 |Underline|{{{__underline___}}}|{{{__underline__}}}|__underline__
81 |Italics|{{{~~italic~~}}}|{{{//italic//}}}|~~italic~~
82 |Striked out|{{{--strike--}}}|{{{--strike--}}}|--strike--
83 |Monospace|<tt>monospace</tt>|{{{##monospace##}}}|##monospace##
84 |Superscript|some <sup>superscript</sup>|{{{some ^^superscript^^}}}|some ^^superscript^^
85 |Subscript|some <sub>subscript</sub>|{{{some ,,subscript,,}}}|some ,,subscript,,
86
87 = Horizontal Line =
88
89 {{info}}There must be 4 or more dashes.{{/info}}
90 {{info}}Note that this is different from Creole where exactly 4 dashes are required.{{/info}}
91
92 (% style="width:100%" %)
93 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
94 |Simple Horizontal Line|{{{----}}}|{{{----}}}|(((----)))
95 |Parametrized Horizontal Line|<hr style="color:blue"/>|((({{{
96 (% style="color:blue" %)
97 ----
98 }}})))|(((
99 (% style="color:blue" %)
100 ----
101 )))
102
103 = Lists =
104
105 (% style="width:100%" %)
106 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
107 |Bulleted list|((({{{
108 * item 1
109 ** item 2
110 *** item 3
111 * item 4
112 }}})))|((({{{
113 * item 1
114 ** item 2
115 *** item 3
116 * item 4
117 }}})))|(((
118 * item 1
119 ** item 2
120 *** item 3
121 * item 4
122 )))
123 |Numbered list|((({{{
124 1. item 1
125 11. item 2
126 111. item 3
127 1. item 4
128 }}})))|((({{{
129 1. item 1
130 11. item 2
131 111. item 3
132 1. item 4
133 }}})))|(((
134 1. item 1
135 11. item 2
136 111. item 3
137 1. item 4
138 )))
139 |Mixed list|((({{{
140 1. item 1
141 1*. item 2
142 1*. item 3
143 1. item 4
144 }}})))|((({{{
145 1. item 1
146 1*. item 2
147 1*. item 3
148 1. item 4
149 }}})))|(((
150 1. item 1
151 1*. item 2
152 1*. item 3
153 1. item 4
154 )))
155 |Square list|((({{{
156 - item 1
157 - item 2
158 }}})))|((({{{
159 (% style="list-style-type: square" %)
160 * item 1
161 * item 2
162 }}})))|(((
163 (% style="list-style-type: square" %)
164 * item 1
165 * item 2
166 )))
167 |Disc list|(((
168 <ul style="list-style-type: disc">
169 <li>item1</li>
170 <li>item2</li>
171 </ul>
172 )))|((({{{
173 (% style="list-style-type: disc" %)
174 * item 1
175 * item 2
176 }}})))|(((
177 (% style="list-style-type: disc" %)
178 * item 1
179 * item 2
180 )))
181 |Lowercase Alphabetical list|((({{{
182 a. item 1
183 a. item 2
184 }}})))|((({{{
185 (% style="list-style-type: lower-alpha" %)
186 * item1
187 * item2
188 }}})))|(((
189 (% style="list-style-type: lower-alpha" %)
190 * item1
191 * item2
192 )))
193 |Uppercase Alphabetical list|((({{{
194 A. item 1
195 A. item 2
196 }}})))|((({{{
197 (% style="list-style-type: upper-alpha" %)
198 * item1
199 * item2
200 }}})))|(((
201 (% style="list-style-type: upper-alpha" %)
202 * item1
203 * item2
204 )))
205 |Lowercase Roman list|((({{{
206 i. item 1
207 i. item 2
208 }}})))|((({{{
209 (% style="list-style-type: lower-roman" %)
210 * item1
211 * item2
212 }}})))|(((
213 (% style="list-style-type: lower-roman" %)
214 * item1
215 * item2
216 )))
217 |Uppercase Roman list|((({{{
218 I. item 1
219 I. item 2
220 }}})))|((({{{
221 (% style="list-style-type: upper-roman" %)
222 * item1
223 * item2
224 }}})))|(((
225 (% style="list-style-type: upper-roman" %)
226 * item1
227 * item2
228 )))
229 |Lowercase Greek list|((({{{
230 g. item 1
231 g. item 2
232 }}})))|((({{{
233 (% style="list-style-type: lower-greek" %)
234 * item1
235 * item2
236 }}})))|(((
237 (% style="list-style-type: lower-greek" %)
238 * item1
239 * item2
240 )))
241 |Uppercase Greek list|((({{{
242 G. item 1
243 G. item 2
244 }}})))|((({{{
245 (% style="list-style-type: upper-greek" %)
246 * item1
247 * item2
248 }}})))|(((
249 (% style="list-style-type: upper-greek" %)
250 * item1
251 * item2
252 )))
253 |Hiragana list|((({{{
254 h. item 1
255 h. item 2
256 }}})))|((({{{
257 (% style="list-style-type: hiragana" %)
258 * item1
259 * item2
260 }}})))|(((
261 (% style="list-style-type: hiragana" %)
262 * item1
263 * item2
264 )))
265 |Hiragana Iroah list|((({{{
266 H. item 1
267 H. item 2
268 }}})))|((({{{
269 (% style="list-style-type: hiragana-iroha" %)
270 * item1
271 * item2
272 }}})))|(((
273 (% style="list-style-type: hiragana-iroha" %)
274 * item1
275 * item2
276 )))
277 |Katakana list|((({{{
278 k. item 1
279 k. item 2
280 }}})))|((({{{
281 (% style="list-style-type: katakana" %)
282 * item1
283 * item2
284 }}})))|(((
285 (% style="list-style-type: katakana" %)
286 * item1
287 * item2
288 )))
289 |Katakana Iroha list|((({{{
290 K. item 1
291 K. item 2
292 }}})))|((({{{
293 (% style="list-style-type: katakana-iroha" %)
294 * item1
295 * item2
296 }}})))|(((
297 (% style="list-style-type: katakana-iroha" %)
298 * item1
299 * item2
300 )))
301 |Armenian list|((({{{
302 <ul style="list-style-type: armenian">
303 <li>item1</li>
304 <li>item2</li>
305 </ul>
306 }}})))|((({{{
307 (% style="list-style-type: armenian" %)
308 * item1
309 * item2
310 }}})))|(((
311 (% style="list-style-type: armenian" %)
312 * item1
313 * item2
314 )))
315 |Hebrew list|((({{{
316 j. item1
317 j. item2
318 }}})))|((({{{
319 (% style="list-style-type: hebrew" %)
320 * item1
321 * item2
322 }}})))|(((
323 (% style="list-style-type: hebrew" %)
324 * item1
325 * item2
326 )))
327 |Georgian list|((({{{
328 <ul style="list-style-type: georgian">
329 <li>item1</li>
330 <li>item2</li>
331 </ul>
332 }}})))|((({{{
333 (% style="list-style-type: georgian" %)
334 * item1
335 * item2
336 }}})))|(((
337 (% style="list-style-type: georgian" %)
338 * item1
339 * item2
340 )))
341 |CJK ideographic list|((({{{
342 <ul style="list-style-type: cjk-ideographic">
343 <li>item1</li>
344 <li>item2</li>
345 </ul>
346 }}})))|((({{{
347 (% style="list-style-type: cjk-ideographic" %)
348 * item1
349 * item2
350 }}})))|(((
351 (% style="list-style-type: cjk-ideographic" %)
352 * item1
353 * item2
354 )))
355
356 = Definition Lists =
357
358 (% style="width:100%" %)
359 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
360 |Standard definition|((({{{
361 <dl>
362 <dt>term</dt>
363 <dd>definition</dd>
364 </dl>
365 }}})))|((({{{
366 ; term
367 : definition
368 }}})))|(((
369 ; term
370 : definition
371 )))
372 |Nested definitions|((({{{
373 <dl>
374 <dt>term1</dt>
375 <dd>definition1
376 <dl>
377 <dt>term2</dt>
378 <dd>definition2</dd>
379 </dl>
380 </dd>
381 </dl>
382 }}})))|((({{{
383 ; term1
384 : definition1
385 :; term2
386 :: definition2
387 }}})))|(((
388 ; term1
389 : definition1
390 :; term2
391 :: definition2
392 )))
393 |Parametrized definition|((({{{
394 <dl style="color:blue">
395 <dt>term</dt>
396 <dd>definition</dd>
397 </dl>
398 }}})))|((({{{
399 (% style="color:blue" %)
400 ; term
401 : definition
402 }}})))|(((
403 (% style="color:blue" %)
404 ; term
405 : definition
406 )))
407
408 = New Line/Line breaks =
409
410 A new line is a carriage return. A line break is a forced new line that can appear anywhere in the text.
411
412 {{info}}
413 In XWiki Syntax 2.0 new lines are honored which is not the case in XWiki Syntax 1.0 and in Creole syntax.
414 {{/info}}
415
416 (% style="width:100%" %)
417 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
418 |Line break|{{{Line\\New line}}}|{{{Line\\New line}}}|Line\\New line|Line\\New line
419 |New line|Line\\New line|Line\\New line|Line New line|Line\\New line
420
421 = Links =
422
423 (% style="width:100%" %)
424 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
425 |Link to a page in the current Space|{{{[WebHome]}}}|{{{[[WebHome]]}}}|[[Web Home>>WebHome]]|[[WebHome]]
426 |Link with a label|{{{[label>WebHome]}}}|{{{[[label>>WebHome]]}}}|[[label>>WebHome]]|[[label>>WebHome]]
427 |Link to a page with the space specified|{{{[Main.WebHome]}}}|{{{[[Main.WebHome]]}}}|[[Web Home>>Main.WebHome]]|[[Main.WebHome]]
428 |Link to a subwiki|{{{[subwiki:Main.WebHome]}}}|{{{[[subwiki:Main.WebHome]]}}}|[[Web Home>>xwiki:Main.WebHome]]|[[xwiki:Main.WebHome]]
429 |Link that opens in a new page|{{{[label>WebHome>_blank]}}}|{{{[[label>>WebHome||rel="__blank"]]}}}|[[label>>WebHome||rel="__blank"]]|[[label>>WebHome||rel="__blank"]]
430 |Link to a URL directly in the text|{{{This is a URL: http://xwiki.org}}}|{{{This is a URL: http://xwiki.org}}}|This is a URL: http://xwiki.org|This is a URL: http://xwiki.org
431 |Link to a URL|{{{[http://xwiki.org]}}}|{{{[[http://xwiki.org]]}}}|[[http://xwiki.org]]|[[http://xwiki.org]]
432 |Link to a URL with a label|{{{[XWiki>http://xwiki.org]}}}|{{{[[XWiki>>http://xwiki.org]]}}}|[[XWiki>>http://xwiki.org]]|[[XWiki>>http://xwiki.org]]
433 |Link to an email|{{{[john@smith.net>mailto:john@smith.net]}}}|{{{[[john@smith.net>>mailto:john@smith.net]]}}}|[[john@smith.net>>mailto:john@smith.net]]|[[john@smith.net>>mailto:john@smith.net]]
434 |Image Link|{{{<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2}</a>}}}|(((
435 {{{[[image:Space2.Page2@img.png>>Space1.Page1]]}}}
436 {{info}}Wiki syntax is supported inside link labels{{/info}}
437 )))|[[image:img.png>>Main.WebHome]]|[[image:img.png>>Main.WebHome]]
438 |Link to attachment|(((
439 {{info}}See [[Attach Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/AttachMacro]] for details{{/info}}
440 {{{{attach:text|file=img.png}}}}
441 )))|{{{[[text>>attach:img.png]]}}}|[[text>>attach:img.png]]|[[text>>attach:img.png]]
442
443 == XWiki Syntax 1.0 Link Specification ==
444
445 The full format of a link is ##(alias[|&gt;])+(link)(@interWikiAlias)+([|&gt;]target)+##
446 * ##alias##: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
447 * ##link##: The full link reference using the following syntax: ##(virtualWikiAlias:)+(space.)+(reference)(?queryString)+(#anchor)+##
448 * Note that either the ##link## or the ##alias## must be specified.
449 ** ##virtualWikiAlias##: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
450 ** ##space##: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
451 ** ##reference##: The link reference. This can be either a URI in the form ##{{{protocol:path}}}## (example: {{{"http://xwiki.org"}}}, {{{"mailto:john@smith.com"}}}) or a wiki page name (example: "WebHome").
452 ** ##queryString##: An optional query string for specifying parameters that will be used in the rendered URL. Example: {{{"mydata1=5&amp;mydata2=Hello"}}}.
453 ** ##anchor##: An optional anchor name pointing to an anchor defined in the referenced link. Note that in XWiki anchors are automatically created for titles. Example: "TableOfContentAnchor".
454 * ##interWikiAlias##: An optional [[Inter Wiki>>http://en.wikipedia.org/wiki/InterWiki]] alias as defined in the InterWiki Map (see the [[Admin Guide>>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/]]). Example: "wikipedia"
455 * ##target##: An optional string corresponding to the HTML ##target## attribute for a HTML ##A## link element. This element is used when rendering the link. It defaults to opening the link in the current page. Examples: "_self", "_blank"
456
457 == XWiki Syntax 2.0 Link Specification ==
458
459 The full format of a link is ##(label>>)?(link)(||parameters)*##
460 * ##label##: the link label, can contain wiki syntax
461 * ##link##: the link target, i.e. where to go when the link is clicked. It has a similar format than in the XWiki 1.0 syntax and it can also contain 2 types of URIs: ##mailto:## and ##attach:## for linking to an email and linking to an attachment respectively.
462 * ##parameters##: An optional list of parameters passed to the link.
463
464 = Tables =
465
466 Allows to easily create content in table format. It also support parameters for table, row or cell in XWiki Syntax 2.0.
467
468 (% style="width:100%" %)
469 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
470 |Standard table|{{{(((
471 {table}
472 Title 1 | Title 2
473 Word 1 | Word 2
474 {table}
475 )))}}}|((({{{
476 |=Title 1|=Title 2
477 |Word 1|Word 2
478 }}})))|(((
479 |=Title 1|=Title 2
480 |Word 1|Word 2
481 )))
482 |Parametrized table|(((
483 <table style="background-color:red;align:center">
484 <tbody>
485 <tr>
486 <td>Title 1</td>
487 <td style="background-color:yellow">Title 2</td>
488 </tr>
489 <tr>
490 <td>Word 1</td>
491 <td>Word 2</td>
492 </tr>
493 </tbody>
494 </table>
495 )))|((({{{
496 (% style="background-color:red;align=center" %)
497 |=Title 1|=(% style="background-color:yellow" %)Title 2
498 |Word 1|Word 2
499 }}})))|(((
500 (% style="background-color:red;align=center" %)
501 |=Title 1|=(% style="background-color:yellow" %)Title 2
502 |Word 1|Word 2
503 )))
504 |Filterable Sortable table|((({{{
505 $xwiki.ssfx.use("js/xwiki/table/table.css")
506 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
507 <table id="tableid" class="grid sortable filterable doOddEven">
508 <tr class="sortHeader">
509 <th>Title1</th>
510 <th>Title2</th>
511 </tr>
512 <tr>
513 <td>Cell11</td>
514 <td>Cell12</td>
515 </tr>
516 <tr>
517 <td>Cell21</td>
518 <td>Cell22</td>
519 </tr>
520 </table>
521 }}})))|((({{{
522 {{velocity}}
523 $xwiki.ssfx.use("js/xwiki/table/table.css")
524 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
525 {{/velocity}}
526 {{html}}
527 <table id="tableid" class="grid sortable filterable doOddEven">
528 <tr class="sortHeader">
529 <th>Title1</th>
530 <th>Title2</th>
531 </tr>
532 <tr>
533 <td>Cell11</td>
534 <td>Cell12</td>
535 </tr>
536 <tr>
537 <td>Cell21</td>
538 <td>Cell22</td>
539 </tr>
540 </table>
541 {{/html}}
542 }}})))|(((
543 {{velocity}}
544 $xwiki.ssfx.use("js/xwiki/table/table.css")
545 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
546 {{/velocity}}
547 {{html}}
548 <table id="tableid" class="grid sortable filterable doOddEven">
549 <tr class="sortHeader">
550 <th>Title1</th>
551 <th>Title2</th>
552 </tr>
553 <tr>
554 <td>Cell11</td>
555 <td>Cell12</td>
556 </tr>
557 <tr>
558 <td>Cell21</td>
559 <td>Cell22</td>
560 </tr>
561 </table>
562 {{/html}}
563 )))
564
565 = Images =
566
567 (% style="width:100%" %)
568 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
569 |Image from attachment in current page|(((
570 {{info}}See [[Image Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/ImageMacro]] for details{{/info}}
571 {{{{image:img.png}}}}
572 )))|{{{image:img.png}}}|image:img.png
573 |Image from attachment in another document|{{{{image:img.png|document=Space.Page}}}}|{{{image:Space.Page@img.png}}}|image:img.png
574 |Image with parameters|{{{{image:img.png|width=25|height=25}}}}|{{{[[image:img.png||width="25" height="25"]]}}}|[[image:img.png||width="25" height="25"]]
575 |Images located at URL|{{{http://some/url/img.png}}}|{{{image:http://some/url/img.png}}}|image:img.png
576
577 = Verbatim =
578
579 Allow to enter content that will not be formatted (in other words the wiki syntax will not be taken into account).
580
581 {{info}}
582 In XWiki Syntax 1.0 the [[Pre macro>>http://code.xwiki.org/xwiki/bin/view/Macros/PreMacro]] only preserves wiki syntax and Radeox macros. However HTML snippets and Groovy/Velocity scripts are still executed.
583 {{/info}}
584
585 (% style="width:100%" %)
586 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
587 |Verbatim inline|{{{Some verbatim {pre}*[not rendered]*{/pre} content}}}|{{{Some verbatim {{{**[[not rendered]]**}}} content}}}|Some verbatim {{{*[not rendered]*}}} content|Some verbatim {{{**[[not rendered]]**}}} content
588 |Verbatim block|((({{{
589 {pre}
590 multi line
591 *verbatim*
592 content
593 {/pre}
594 }}}
595 {{info}}It's also possible to use the [[Code macro>>http://code.xwiki.org/xwiki/bin/view/Macros/CodeMacro]] but it displays its content in a box by default.{{/info}}
596 )))|((({{{
597 {{{
598 multi line
599 **verbatim**
600 content
601 }}}
602 }}})))|((({{{
603 multi line
604 *verbatim*
605 content
606 }}})))|((({{{
607 multi line
608 **verbatim**
609 content
610 }}})))
611
612 = Quotations =
613
614 Allows to quote some text.
615
616 (% style="width:100%" %)
617 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
618 |Simple quote|(((
619 <blockquote><p>john said this</p></blockquote>
620 I said ok
621 )))|((({{{
622 > john said this
623 I said ok
624 }}})))|(((
625 > john said this
626 I said ok
627 )))
628 |Nested quotes|(((
629 <blockquote><p>john said this</p>
630 <blockquote><p>marie answered that</p></blockquote>
631 </blockquote>
632 I said ok
633 )))|((({{{
634 > john said this
635 >> marie answered that
636 I said ok
637 }}})))|(((
638 > john said this
639 >> marie answered that
640 I said ok
641 )))
642
643 = Groups =
644
645 Groups can be used to insert another document inline directly into the current document. This allows for example to insert complex elements inside a list item or inside a table cell. Groups are delimited by the following syntactic elements: ##{{{(((...)))}}}##. One Group can contain another Group and there is no limit of imbrication.
646
647 (% style="width:100%" %)
648 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
649 |{{info}}This feature doesn't exist in XWiki syntax 1.0. You'd have to use pure HTML to achieve the result.{{/info}}|((({{{
650 |=Header 1|=Header 2|=Header 3
651 |Cell One|(((
652 = Embedded document
653
654 Some embedded paragraph.
655
656 * list item one
657 * list item two
658 ** sub-item 1
659 ** sub-item 2
660 ))) | Cell Three
661
662 Next paragraph in the top-level document
663 }}})))|(((
664 |=Header 1|=Header 2|=Header 3
665 |Cell One|(((
666 {{html}}<h1 id="HEmbeddeddocument"><span>Embedded document</span></h1>{{/html}}
667
668 Some embedded paragraph.
669
670 * list item one
671 * list item two
672 ** sub-item 1
673 ** sub-item 2
674 ))) | Cell Three
675
676 Next paragraph in the top-level document
677 )))
678
679 = Escapes =
680
681 (% style="width:100%" %)
682 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
683 |Escape a character|{{{This is not a \[link\]}}}|(((
684 {{{This is not a ~[~[link~]~]}}}
685 {{info}}To enter a ~~ character use a double escape: ~~~~{{/info}}
686 )))|{{{This is not a [link]}}}|{{{This is not a [[link]]}}}
687
688 = Macros =
689
690 There are 2 kinds of macros in XWiki syntax 1.0:
691 * Velocity macros (called using the ###macroname(param1 ... paramN)## syntax)
692 * Radeox macros (called using the ##{macroname:param1=value1|...|paramN=valueN}## syntax)
693
694 There are also 2 kinds of macros in XWiki Syntax 2.0:
695 * Velocity macros (called using the ###macroname(param1 ... paramN)## syntax inside the Velocity Macro)
696 * XWiki macros (called using the ##{{{{{macroname param1="value1" ... paramN="valueN"}}}}}## syntax)
697
698 {{info}}The Radeox macros cannot be used in XWiki Syntax 2.0. Thus they have been rewritten as XWiki macros.{{/info}}
699
700 {{info}}For the full list of available macros check the [[Macro Reference page>>http://code.xwiki.org/xwiki/bin/view/Macros/]].{{/info}}
701
702 (% style="width:100%" %)
703 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
704 |Velocity Macro|((({{{#info("Some text")}}})))|((({{{
705 {{velocity}}{{html}}
706 #info("some text")
707 {{/html}}{{/velocity}}
708 }}}
709 {{info}}We're using the HTML macro in the example since the ###info## macro returns HTML content.{{/info}}
710 {{info}}Starting with XE 2.0 you should use the [[Message Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/MessageMacro]] to implement this example.{{/info}}
711 )))
712 |Radeox Macro/XWiki Macros|((({{{
713 {code:java}
714 java content
715 {code}
716 }}})))|((({{{
717 {{code language="java"}}
718 java content
719 {{/code}}
720 }}})))
721
722 = HTML =
723
724 {{info}}In XWiki Syntax 2.0 HTML or XHTML must be entered by using the HTML macro whereas in XWiki Syntax 1.0 it's possible to enter HTML directly in the text.{{/info}}
725
726 (% style="width:100%" %)
727 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
728 |<b>bold</b>|{{{{{html}}<b>bold</b>{{/html}}}}}|{{html}}<b>bold</b>{{/html}}
729
730 {{info}}In XWiki Syntax 2.0, by default the HTML macro does not understands wiki syntax (other macros included since it's wiki syntax too). To enable it, use {{{{{html wiki="true"}}}}}.{{/info}}
731
732 = Velocity/Groovy Scripts =
733
734 {{info}}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.0 Velocity scripts must be entered using the ##velocity## macro. Same goes for entering Groovy scripts.{{/info}}
735
736 (% style="width:100%" %)
737 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
738 |Velocity script|((({{{
739 #set ($var = "whatever")
740 }}})))|((({{{
741 {{velocity}}
742 #set ($var = "whatever")
743 {{/velocity}}
744 }}})))
745 |Groovy script|((({{{
746 <%
747 def var = "whatever"
748 %>
749 }}})))|((({{{
750 {{groovy}}
751 def var = "whatever"
752 {{/groovy}}
753 }}})))
754
755 = Parameters =
756
757 With XWiki Syntax 2.0 it's possible to pass parameters to the different syntax elements and also to blocks of text. This is used for example to style them. You can set any parameter key/value pair you want. The XHTML renderer will pass these parameters as XHTML attributes to the underlying XHTML representation of the different syntax elements. In XWiki Syntax 1.0 there was no syntax for passing parameters and the only way to do it was to write XHTML directly in the content as shown in the table below.
758
759 (% style="width:100%" %)
760 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Generated XHTML
761 |((({{{
762 <h1 class="myClass" style="myStyle" id="myId">header</h1>
763 }}})))|((({{{
764 (% class="myClass" style="myStyle" id="myId" %)
765 = header =
766 }}})))|((({{{
767 <h1 class="myClass" style="myStyle" id="myId">header</h1>
768 }}})))
769
770 {{id name="syntaxes"/}}
771 = Other syntaxes =
772
773 The following other syntaxes are implemented in XWiki Enterprise 1.6 and later:
774 * [[JSPWiki>>http://www.jspwiki.org/wiki/TextFormattingRules]]
775 * [[MediaWiki>>http://en.wikipedia.org/wiki/Help:Editing]]
776 * [[Confluence>>http://confluence.atlassian.com/display/CONF20/Confluence+Notation+Guide+Overview]]
777 * [[TWiki>>http://twiki.org/cgi-bin/view/TWiki/WikiSyntax]]
778 * [[Creole 1.0>>http://www.wikicreole.org/wiki/Creole1.0]]
779 * [[XHTML 1.0>>http://www.w3.org/TR/xhtml1/]]
780
781 {{warning}}The implementation for these syntaxes is not fully finished yet. For example support for links is not working perfectly yet. We also need to define if we want to extend the original syntaxes to support XWiki-specific features like ability to link to another sub-wiki.{{/warning}}