Wiki source code of XWiki Syntaxes

Last modified by Admin on 2010/05/19 20:19

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 |Parametrized headers|<h1><span style="color:blue">header</span></h1>|{{{(% style="color:blue" %)}}}\\= header =|(((
61 {{html}}
62 <h1 id="Hheader" style="color:blue"><span>header</span></h1>
63 {{/html}})))
64 |Headers with wiki syntax|1.1.1 Header with *bold*|{{{=== Header with **bold** ===}}}|(((=== Header with **bold** ===)))
65
66 = Text Formatting =
67
68 {{info}}
69 New in XWiki Syntax 2.0 over XWiki Syntax 1.0:
70 * Spaces are allowed just after the syntax symbols (for example in XWiki Syntax 1.0, this was not * bold *).
71 * 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.
72 * Ability to span several lines (wasn't the case in XWiki Syntax 1.0).
73 {{/info}}
74
75 (% style="width:100%" %)
76 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
77 |Bold|{{{*bold*}}}|{{{**bold**}}}|**bold**
78 |Underline|{{{__underline___}}}|{{{__underline__}}}|__underline__
79 |Italics|{{{~~italic~~}}}|{{{//italic//}}}|~~italic~~
80 |Striked out|{{{--strike--}}}|{{{--strike--}}}|--strike--
81 |Monospace|<tt>monospace</tt>|{{{##monospace##}}}|##monospace##
82 |Superscript|some <sup>superscript</sup>|{{{some ^^superscript^^}}}|some ^^superscript^^
83 |Subscript|some <sub>subscript</sub>|{{{some ,,subscript,,}}}|some ,,subscript,,
84
85 = Horizontal Line =
86
87 {{info}}There must be 4 or more dashes.{{/info}}
88
89 {{info}}Note that this is different from Creole where exactly 4 dashes are required.{{/info}}
90
91 (% style="width:100%" %)
92 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
93 |Simple Horizontal Line|{{{----}}}|{{{----}}}|(((----)))
94 |Parametrized Horizontal Line|<hr style="color:blue"/>|((({{{
95 (% style="color:blue" %)
96 ----
97 }}})))|(((
98 (% style="color:blue" %)
99 ----
100 )))
101
102 = Lists =
103
104 (% style="width:100%" %)
105 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
106 |Bulleted list|((({{{
107 * item 1
108 ** item 2
109 *** item 3
110 * item 4
111 }}})))|((({{{
112 * item 1
113 ** item 2
114 *** item 3
115 * item 4
116 }}})))|(((
117 * item 1
118 ** item 2
119 *** item 3
120 * item 4
121 )))
122 |Numbered list|((({{{
123 1. item 1
124 11. item 2
125 111. item 3
126 1. item 4
127 }}})))|((({{{
128 1. item 1
129 11. item 2
130 111. item 3
131 1. item 4
132 }}})))|(((
133 1. item 1
134 11. item 2
135 111. item 3
136 1. item 4
137 )))
138 |Mixed list|((({{{
139 1. item 1
140 1*. item 2
141 1*. item 3
142 1. item 4
143 }}})))|((({{{
144 1. item 1
145 1*. item 2
146 1*. item 3
147 1. item 4
148 }}})))|(((
149 1. item 1
150 1*. item 2
151 1*. item 3
152 1. item 4
153 )))
154 |Square list|((({{{
155 - item 1
156 - item 2
157 }}})))|((({{{
158 (% style="list-style-type: square" %)
159 * item 1
160 * item 2
161 }}})))|(((
162 (% style="list-style-type: square" %)
163 * item 1
164 * item 2
165 )))
166 |Disc list|(((
167 <ul style="list-style-type: disc">
168 <li>item1</li>
169 <li>item2</li>
170 </ul>
171 )))|((({{{
172 (% style="list-style-type: disc" %)
173 * item 1
174 * item 2
175 }}})))|(((
176 (% style="list-style-type: disc" %)
177 * item 1
178 * item 2
179 )))
180 |Lowercase Alphabetical list|((({{{
181 a. item 1
182 a. item 2
183 }}})))|((({{{
184 (% style="list-style-type: lower-alpha" %)
185 * item1
186 * item2
187 }}})))|(((
188 (% style="list-style-type: lower-alpha" %)
189 * item1
190 * item2
191 )))
192 |Uppercase Alphabetical list|((({{{
193 A. item 1
194 A. item 2
195 }}})))|((({{{
196 (% style="list-style-type: upper-alpha" %)
197 * item1
198 * item2
199 }}})))|(((
200 (% style="list-style-type: upper-alpha" %)
201 * item1
202 * item2
203 )))
204 |Lowercase Roman list|((({{{
205 i. item 1
206 i. item 2
207 }}})))|((({{{
208 (% style="list-style-type: lower-roman" %)
209 * item1
210 * item2
211 }}})))|(((
212 (% style="list-style-type: lower-roman" %)
213 * item1
214 * item2
215 )))
216 |Uppercase Roman list|((({{{
217 I. item 1
218 I. item 2
219 }}})))|((({{{
220 (% style="list-style-type: upper-roman" %)
221 * item1
222 * item2
223 }}})))|(((
224 (% style="list-style-type: upper-roman" %)
225 * item1
226 * item2
227 )))
228 |Lowercase Greek list|((({{{
229 g. item 1
230 g. item 2
231 }}})))|((({{{
232 (% style="list-style-type: lower-greek" %)
233 * item1
234 * item2
235 }}})))|(((
236 (% style="list-style-type: lower-greek" %)
237 * item1
238 * item2
239 )))
240 |Uppercase Greek list|((({{{
241 G. item 1
242 G. item 2
243 }}})))|((({{{
244 (% style="list-style-type: upper-greek" %)
245 * item1
246 * item2
247 }}})))|(((
248 (% style="list-style-type: upper-greek" %)
249 * item1
250 * item2
251 )))
252 |Hiragana list|((({{{
253 h. item 1
254 h. item 2
255 }}})))|((({{{
256 (% style="list-style-type: hiragana" %)
257 * item1
258 * item2
259 }}})))|(((
260 (% style="list-style-type: hiragana" %)
261 * item1
262 * item2
263 )))
264 |Hiragana Iroah list|((({{{
265 H. item 1
266 H. item 2
267 }}})))|((({{{
268 (% style="list-style-type: hiragana-iroha" %)
269 * item1
270 * item2
271 }}})))|(((
272 (% style="list-style-type: hiragana-iroha" %)
273 * item1
274 * item2
275 )))
276 |Katakana list|((({{{
277 k. item 1
278 k. item 2
279 }}})))|((({{{
280 (% style="list-style-type: katakana" %)
281 * item1
282 * item2
283 }}})))|(((
284 (% style="list-style-type: katakana" %)
285 * item1
286 * item2
287 )))
288 |Katakana Iroha list|((({{{
289 K. item 1
290 K. item 2
291 }}})))|((({{{
292 (% style="list-style-type: katakana-iroha" %)
293 * item1
294 * item2
295 }}})))|(((
296 (% style="list-style-type: katakana-iroha" %)
297 * item1
298 * item2
299 )))
300 |Armenian list|((({{{
301 <ul style="list-style-type: armenian">
302 <li>item1</li>
303 <li>item2</li>
304 </ul>
305 }}})))|((({{{
306 (% style="list-style-type: armenian" %)
307 * item1
308 * item2
309 }}})))|(((
310 (% style="list-style-type: armenian" %)
311 * item1
312 * item2
313 )))
314 |Hebrew list|((({{{
315 j. item1
316 j. item2
317 }}})))|((({{{
318 (% style="list-style-type: hebrew" %)
319 * item1
320 * item2
321 }}})))|(((
322 (% style="list-style-type: hebrew" %)
323 * item1
324 * item2
325 )))
326 |Georgian list|((({{{
327 <ul style="list-style-type: georgian">
328 <li>item1</li>
329 <li>item2</li>
330 </ul>
331 }}})))|((({{{
332 (% style="list-style-type: georgian" %)
333 * item1
334 * item2
335 }}})))|(((
336 (% style="list-style-type: georgian" %)
337 * item1
338 * item2
339 )))
340 |CJK ideographic list|((({{{
341 <ul style="list-style-type: cjk-ideographic">
342 <li>item1</li>
343 <li>item2</li>
344 </ul>
345 }}})))|((({{{
346 (% style="list-style-type: cjk-ideographic" %)
347 * item1
348 * item2
349 }}})))|(((
350 (% style="list-style-type: cjk-ideographic" %)
351 * item1
352 * item2
353 )))
354
355 = Definition Lists =
356
357 (% style="width:100%" %)
358 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
359 |Standard definition|((({{{
360 <dl>
361 <dt>term</dt>
362 <dd>definition</dd>
363 </dl>
364 }}})))|((({{{
365 ; term
366 : definition
367 }}})))|(((
368 ; term
369 : definition
370 )))
371 |Nested definitions|((({{{
372 <dl>
373 <dt>term1</dt>
374 <dd>definition1
375 <dl>
376 <dt>term2</dt>
377 <dd>definition2</dd>
378 </dl>
379 </dd>
380 </dl>
381 }}})))|((({{{
382 ; term1
383 : definition1
384 :; term2
385 :: definition2
386 }}})))|(((
387 ; term1
388 : definition1
389 :; term2
390 :: definition2
391 )))
392 |Parametrized definition|((({{{
393 <dl style="color:blue">
394 <dt>term</dt>
395 <dd>definition</dd>
396 </dl>
397 }}})))|((({{{
398 (% style="color:blue" %)
399 ; term
400 : definition
401 }}})))|(((
402 (% style="color:blue" %)
403 ; term
404 : definition
405 )))
406
407 = New Line/Line breaks =
408
409 A new line is a carriage return. A line break is a forced new line that can appear anywhere in the text.
410
411 {{info}}
412 In XWiki Syntax 2.0 new lines are honored which is not the case in XWiki Syntax 1.0 and in Creole syntax.
413 {{/info}}
414
415 (% style="width:100%" %)
416 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
417 |Line break|{{{Line\\New line}}}|{{{Line\\New line}}}|Line\\New line|Line\\New line
418 |New line|Line\\New line|Line\\New line|Line New line|Line\\New line
419
420 = Links =
421
422 (% style="width:100%" %)
423 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
424 |Link to a page in the current Space|{{{[WebHome]}}}|{{{[[WebHome]]}}}|[[Web Home>>WebHome]]|[[WebHome]]
425 |Link with a label|{{{[label>WebHome]}}}|{{{[[label>>WebHome]]}}}|[[label>>WebHome]]|[[label>>WebHome]]
426 |Link to a page with the space specified|{{{[Main.WebHome]}}}|{{{[[Main.WebHome]]}}}|[[Web Home>>Main.WebHome]]|[[Main.WebHome]]
427 |Link to a subwiki|{{{[subwiki:Main.WebHome]}}}|{{{[[subwiki:Main.WebHome]]}}}|[[Web Home>>xwiki:Main.WebHome]]|[[xwiki:Main.WebHome]]
428 |Link that opens in a new page|{{{[label>WebHome>_blank]}}}|{{{[[label>>WebHome||rel="__blank"]]}}}|[[label>>WebHome||rel="__blank"]]|[[label>>WebHome||rel="__blank"]]
429 |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
430 |Link to a URL|{{{[http://xwiki.org]}}}|{{{[[http://xwiki.org]]}}}|[[http://xwiki.org]]|[[http://xwiki.org]]
431 |Link to a URL with a label|{{{[XWiki>http://xwiki.org]}}}|{{{[[XWiki>>http://xwiki.org]]}}}|[[XWiki>>http://xwiki.org]]|[[XWiki>>http://xwiki.org]]
432 |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]]
433 |Image Link|{{{<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2}</a>}}}|(((
434 {{{[[image:Space2.Page2@img.png>>Space1.Page1]]}}}
435 {{info}}Wiki syntax is supported inside link labels{{/info}}
436 )))|[[image:img.png>>Main.WebHome]]|[[image:img.png>>Main.WebHome]]
437 |Link to attachment|(((
438 {{info}}See [[Attach Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/AttachMacro]] for details{{/info}}
439 {{{{attach:text|file=img.png}}}}
440 )))|{{{[[text>>attach:img.png]]}}}|[[text>>attach:img.png]]|[[text>>attach:img.png]]
441
442 == XWiki Syntax 1.0 Link Specification ==
443
444 The full format of a link is ##(alias[|&gt;])+(link)(@interWikiAlias)+([|&gt;]target)+##
445 * ##alias##: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
446 * ##link##: The full link reference using the following syntax: ##(virtualWikiAlias:)+(space.)+(reference)(?queryString)+(#anchor)+##
447 * Note that either the ##link## or the ##alias## must be specified.
448 ** ##virtualWikiAlias##: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
449 ** ##space##: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
450 ** ##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").
451 ** ##queryString##: An optional query string for specifying parameters that will be used in the rendered URL. Example: {{{"mydata1=5&amp;mydata2=Hello"}}}.
452 ** ##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".
453 * ##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"
454 * ##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"
455
456 == XWiki Syntax 2.0 Link Specification ==
457
458 The full format of a link is ##(label>>)?(link)(||parameters)*##
459 * ##label##: the link label, can contain wiki syntax
460 * ##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.
461 * ##parameters##: An optional list of parameters passed to the link.
462
463 = Tables =
464
465 Allows to easily create content in table format. It also support parameters for table, row or cell in XWiki Syntax 2.0.
466
467 (% style="width:100%" %)
468 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
469 |Standard table|{{{(((
470 {table}
471 Title 1 | Title 2
472 Word 1 | Word 2
473 {table}
474 )))}}}|((({{{
475 |=Title 1|=Title 2
476 |Word 1|Word 2
477 }}})))|(((
478 |=Title 1|=Title 2
479 |Word 1|Word 2
480 )))
481 |Parametrized table|(((
482 <table style="background-color:red;align:center">
483 <tbody>
484 <tr>
485 <td>Title 1</td>
486 <td style="background-color:yellow">Title 2</td>
487 </tr>
488 <tr>
489 <td>Word 1</td>
490 <td>Word 2</td>
491 </tr>
492 </tbody>
493 </table>
494 )))|((({{{
495 (% style="background-color:red;align=center" %)
496 |=Title 1|=(% style="background-color:yellow" %)Title 2
497 |Word 1|Word 2
498 }}})))|(((
499 (% style="background-color:red;align=center" %)
500 |=Title 1|=(% style="background-color:yellow" %)Title 2
501 |Word 1|Word 2
502 )))
503 |Filterable Sortable table|((({{{
504 $xwiki.ssfx.use("js/xwiki/table/table.css")
505 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
506 <table id="tableid" class="grid sortable filterable doOddEven">
507 <tr class="sortHeader">
508 <th>Title1</th>
509 <th>Title2</th>
510 </tr>
511 <tr>
512 <td>Cell11</td>
513 <td>Cell12</td>
514 </tr>
515 <tr>
516 <td>Cell21</td>
517 <td>Cell22</td>
518 </tr>
519 </table>
520 }}})))|((({{{
521 {{velocity}}
522 $xwiki.ssfx.use("js/xwiki/table/table.css")
523 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
524 {{/velocity}}
525
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 {{velocity}}
543 $xwiki.ssfx.use("js/xwiki/table/table.css")
544 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
545 {{/velocity}}
546
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 = Images =
565
566 (% style="width:100%" %)
567 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
568 |Image from attachment in current page|(((
569 {{info}}See [[Image Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/ImageMacro]] for details{{/info}}
570 {{{{image:img.png}}}}
571 )))|{{{image:img.png}}}|image:img.png
572 |Image from attachment in another document|{{{{image:img.png|document=Space.Page}}}}|{{{image:Space.Page@img.png}}}|image:img.png
573 |Image with parameters|{{{{image:img.png|width=25|height=25}}}}|{{{[[image:img.png||width="25" height="25"]]}}}|[[image:img.png||width="25" height="25"]]
574 |Images located at URL|{{{http://some/url/img.png}}}|{{{image:http://some/url/img.png}}}|image:img.png
575
576 = Verbatim =
577
578 Allow to enter content that will not be formatted (in other words the wiki syntax will not be taken into account).
579
580 {{info}}
581 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.
582 {{/info}}
583
584 (% style="width:100%" %)
585 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
586 |Verbatim inline|{{{Some verbatim {pre}*[not rendered]*{/pre} content}}}|{{{Some verbatim {{{**[[not rendered]]**}}} content}}}|Some verbatim {{{*[not rendered]*}}} content|Some verbatim {{{**[[not rendered]]**}}} content
587 |Verbatim block|((({{{
588 {pre}
589 multi line
590 *verbatim*
591 content
592 {/pre}
593 }}}
594 {{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}}
595 )))|((({{{
596 {{{
597 multi line
598 **verbatim**
599 content
600 }}}
601 }}})))|((({{{
602 multi line
603 *verbatim*
604 content
605 }}})))|((({{{
606 multi line
607 **verbatim**
608 content
609 }}})))
610
611 = Quotations =
612
613 Allows to quote some text.
614
615 (% style="width:100%" %)
616 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
617 |Simple quote|(((
618 <blockquote><p>john said this</p></blockquote>
619 I said ok
620 )))|((({{{
621 > john said this
622 I said ok
623 }}})))|(((
624 > john said this
625 I said ok
626 )))
627 |Nested quotes|(((
628 <blockquote><p>john said this</p>
629 <blockquote><p>marie answered that</p></blockquote>
630 </blockquote>
631 I said ok
632 )))|((({{{
633 > john said this
634 >> marie answered that
635 I said ok
636 }}})))|(((
637 > john said this
638 >> marie answered that
639 I said ok
640 )))
641
642 = Groups =
643
644 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.
645
646 (% style="width:100%" %)
647 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
648 |{{info}}This feature doesn't exist in XWiki syntax 1.0. You'd have to use pure HTML to achieve the result.{{/info}}|((({{{
649 |=Header 1|=Header 2|=Header 3
650 |Cell One|(((
651 = Embedded document
652
653 Some embedded paragraph.
654
655 * list item one
656 * list item two
657 ** sub-item 1
658 ** sub-item 2
659 ))) | Cell Three
660
661 Next paragraph in the top-level document
662 }}})))|(((
663 |=Header 1|=Header 2|=Header 3
664 |Cell One|(((
665 {{html}}<h1 id="HEmbeddeddocument"><span>Embedded document</span></h1>{{/html}}
666
667 Some embedded paragraph.
668
669 * list item one
670 * list item two
671 ** sub-item 1
672 ** sub-item 2
673 ))) | Cell Three
674
675 Next paragraph in the top-level document
676 )))
677
678 = Escapes =
679
680 (% style="width:100%" %)
681 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
682 |Escape a character|{{{This is not a \[link\]}}}|(((
683 {{{This is not a ~[~[link~]~]}}}
684 {{info}}To enter a ~~ character use a double escape: ~~~~{{/info}}
685 )))|{{{This is not a [link]}}}|{{{This is not a [[link]]}}}
686
687 = Macros =
688
689 There are 2 kinds of macros in XWiki syntax 1.0:
690 * Velocity macros (called using the ###macroname(param1 ... paramN)## syntax)
691 * Radeox macros (called using the ##{macroname:param1=value1|...|paramN=valueN}## syntax)
692
693 There are also 2 kinds of macros in XWiki Syntax 2.0:
694 * Velocity macros (called using the ###macroname(param1 ... paramN)## syntax inside the Velocity Macro)
695 * XWiki macros (called using the ##{{{{{macroname param1="value1" ... paramN="valueN"}}}}}## syntax)
696
697 {{info}}The Radeox macros cannot be used in XWiki Syntax 2.0. Thus they have been rewritten as XWiki macros.{{/info}}
698
699 {{info}}For the full list of available macros check the [[Macro Reference page>>http://code.xwiki.org/xwiki/bin/view/Macros/]].{{/info}}
700
701 (% style="width:100%" %)
702 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
703 |Velocity Macro|((({{{#info("Some text")}}})))|((({{{
704 {{velocity}}{{html}}
705 #info("some text")
706 {{/html}}{{/velocity}}}}}
707 {{info}}We're using the HTML macro in the example since the ###info## macro returns HTML content.{{/info}}
708
709 {{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}}
710 )))
711 |Radeox Macro/XWiki Macros|((({{{
712 {code:java}
713 java content
714 {code}
715 }}})))|((({{{
716 {{code language="java"}}
717 java content
718 {{/code}}
719 }}})))
720
721 = HTML =
722
723 {{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}}
724
725 (% style="width:100%" %)
726 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
727 |<b>bold</b>|{{{{{html}}<b>bold</b>{{/html}}}}}|{{html}}<b>bold</b>{{/html}}
728
729 {{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}}
730
731 = Velocity/Groovy Scripts =
732
733 {{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}}
734
735 (% style="width:100%" %)
736 |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
737 |Velocity script|((({{{
738 #set ($var = "whatever")
739 }}})))|((({{{
740 {{velocity}}
741 #set ($var = "whatever")
742 {{/velocity}}
743 }}})))
744 |Groovy script|((({{{
745 <%
746 def var = "whatever"
747 %>
748 }}})))|((({{{
749 {{groovy}}
750 def var = "whatever"
751 {{/groovy}}
752 }}})))
753
754 = Parameters =
755
756 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.
757
758 (% style="width:100%" %)
759 |=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Generated XHTML
760 |((({{{
761 <h1 class="myClass" style="myStyle" id="myId">header</h1>
762 }}})))|((({{{
763 (% class="myClass" style="myStyle" id="myId" %)
764 = header =
765 }}})))|((({{{
766 <h1 class="myClass" style="myStyle" id="myId">header</h1>
767 }}})))
768
769 {{id name="syntaxes"/}}
770 = Other syntaxes =
771
772 The following other syntaxes are implemented in XWiki Enterprise 1.6 and later:
773 * [[JSPWiki>>http://www.jspwiki.org/wiki/TextFormattingRules]]
774 * [[MediaWiki>>http://en.wikipedia.org/wiki/Help:Editing]]
775 * [[Confluence>>http://confluence.atlassian.com/display/CONF20/Confluence+Notation+Guide+Overview]]
776 * [[TWiki>>http://twiki.org/cgi-bin/view/TWiki/WikiSyntax]]
777 * [[Creole 1.0>>http://www.wikicreole.org/wiki/Creole1.0]]
778 * [[XHTML 1.0>>http://www.w3.org/TR/xhtml1/]]
779
780 {{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}}