Code source wiki de XWikiSyntax

Modifié par Administrator le 2009/12/22 09:35

Afficher les derniers auteurs
1 1 XWiki Syntax
2
3 * [Titles>#HTitles]
4 * [Paragraphs>#HParagraphs]
5 * [Lists>#HLists]
6 ** [Bulleted Lists>#HBulletedLists]
7 ** [Numbered Lists>#HNumberedLists]
8 ** [Definition Lists>#HDefinitionLists]
9 * [Text Styles>#HTextStyles]
10 * [Horizontal Line>#HHorizontalLine]
11 * [Links>#HLinks]
12 ** [Internal Links>#HInternalLinks]
13 ** [External Links>#HExternalLinks]
14 * [Tables>#HTables]
15 * [Images>#HImages]
16 * [Escaping Text>#HEscapingText]
17 ** [Escaping a single character>#HEscapingasinglecharacter]
18 ** [Escaping wiki syntax rendering>#HEscapingwikisyntaxrendering]
19 ** [Escaping everything>#HEscapingeverything]
20 * [Boxes>#HBoxes]
21 * [Other macros>#HOtherMacros]
22
23 In addition to these special wiki syntaxes XWiki allows any HTML to be inserted in a page so if there no wiki syntax for what you wish to achieve, consider using HTML.
24
25 1.1 Titles
26
27 {pre}
28 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
29 <tr>
30 <th>Example</th>
31 <th>Result</th>
32 </tr>
33 <tr>
34 <td>
35 <pre>
36 1 Title 1
37 1.1 Title 2
38 1.1.1 Title 3
39 1.1.1.1 Title 4
40 1.1.1.1.1 Title 5
41 1.1.1.1.1.1 Title 6
42 </pre>
43 </td>
44 <td>
45 <h2><span id="HTitle1">Title 1</span></h2><p class="paragraph"/>
46 <h3><span id="HTitle2">Title 2</span></h3><p class="paragraph"/>
47 <h4><span id="HTitle3">Title 3</span></h4><p class="paragraph"/>
48 <h5><span id="HTitle4">Title 4</span></h5><p class="paragraph"/>
49 <h6><span id="HTitle5">Title 5</span></h6><p class="paragraph"/>
50 <h6><span id="HTitle6">Title 6</span></h6><p class="paragraph"/>
51 </td>
52 </tr>
53 </table>
54 {/pre}
55
56 1.1 Paragraphs
57
58 {pre}
59 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
60 <tr>
61 <th>Example</th>
62 <th>Result</th>
63 </tr>
64 <tr>
65 <td>
66 <pre>
67 Here is a paragraph.
68 This text continues the same paragraph.
69
70 This paragraph is a new one.
71
72 This paragraph is another new one.
73
74 This paragraph is displayed\\
75 on two lines.
76 </pre>
77 </td>
78 <td>
79 Here is a paragraph.
80 This text continues the same paragraph.<p class="paragraph"/>This paragraph is a new one.<p class="paragraph"/>This paragraph is another new one.<p class="paragraph"/>
81 This paragraph is displayed<br/>on two lines.
82 </td>
83 </tr>
84 </table>
85 {/pre}
86
87 1.1 Lists
88
89 1.1.1 Bulleted Lists
90
91 {pre}
92 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
93 <tr>
94 <th>Example</th>
95 <th>Result</th>
96 </tr>
97 <tr>
98 <td>
99 <pre>
100 * Item 1
101 ** Item 2
102 *** Item 3
103 * Item 4
104 </pre>
105 </td>
106 <td>
107 <ul class="star">
108 <li>Item 1
109 <ul class="star">
110 <li>Item 2
111 <ul class="star">
112 <li>Item 3</li>
113 </ul>
114 </li>
115 </ul>
116 </li>
117 <li>Item 4</li>
118 </ul>
119 </td>
120 </tr>
121 </table>
122 {/pre}
123
124 1.1.1 Numbered Lists
125
126 {pre}
127 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
128 <tr>
129 <th>Example</th>
130 <th>Result</th>
131 </tr>
132 <tr>
133 <td>
134 <pre>
135 1. Item 1
136 11. Item 2
137 111. Item 3
138 1. Item 4
139
140 1. Item 1
141 1*. Item 2
142 1*. Item 3
143 1. Item 4
144
145 a. Alphabetical enumerated list
146 a. Alphabetical enumerated list
147
148 A. Uppercase alphabetical enumerated list
149 A. Uppercase alphabetical enumerated list
150
151 i. Roman enumerated list
152 i. Roman enumerated list
153
154 I. Uppercase roman enumerated list
155 I. Uppercase roman enumerated list
156
157 g. Greek enumerated list
158 g. Greek enumerated list
159
160 h. Hirigana (jap.) enumerated list
161 h. Hirigana (jap.) enumerated list
162
163 k. Katakana (jap.) enumerated list
164 k. Katakana (jap.) enumerated list
165 </pre>
166 </td>
167 <td>
168 <ol>
169 <li>Item 1
170 <ol>
171 <li>Item 2
172 <ol>
173 <li>Item 3</li>
174 </ol>
175 </li>
176 </ol>
177 </li>
178 <li>Item 4</li>
179 </ol>
180
181 <ol>
182 <li>Item 1
183 <ul class="star">
184 <li>Item 2</li>
185 <li>Item 3</li>
186 </ul>
187 </li>
188 <li>Item 4</li>
189 </ol>
190
191 <ol class="alpha">
192 <li>Alphabetical enumerated list</li>
193 <li>Alphabetical enumerated list</li>
194 </ol>
195
196 <ol class="ALPHA">
197 <li>Uppercase alphabetical enumerated list</li>
198 <li>Uppercase alphabetical enumerated list</li>
199 </ol>
200
201 <ol class="roman">
202 <li>Roman enumerated list</li>
203 <li>Roman enumerated list</li>
204 </ol>
205
206 <ol class="ROMAN">
207 <li>Uppercase roman enumerated list</li>
208 <li>Uppercase roman enumerated list</li>
209 </ol>
210
211 <ol class="greek">
212 <li>Greek enumerated list</li>
213 <li>Greek enumerated list</li>
214 </ol>
215
216 <ol class="hiragana">
217 <li>Hirigana (jap.) enumerated list</li>
218 <li>Hirigana (jap.) enumerated list</li>
219 </ol>
220
221 <ol class="katakana">
222 <li>Katakana (jap.) enumerated list</li>
223 <li>Katakana (jap.) enumerated list</li>
224 </ol>
225
226 </td>
227 </tr>
228 </table>
229 {/pre}
230
231 1.1.1 Definition Lists
232
233 {pre}
234 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
235 <tr>
236 <th>Example</th>
237 <th>Result</th>
238 </tr>
239 <tr>
240 <td>
241 <pre>
242 &lt;dl&gt;
243 &lt;dt&gt;Term&lt;/dt&gt;
244 &lt;dd&gt;Definition&lt;/dd&gt;
245 &lt;/dl&gt;
246 </pre>
247 </td>
248 <td>
249 <dl>
250 <dt>Term</dt>
251 <dd>Definition</dd>
252 </dl>
253 </td>
254 </tr>
255 </table>
256 {/pre}
257
258 1.1 Text Styles
259
260 {pre}
261 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
262 <tr>
263 <th>Example</th>
264 <th>Result</th>
265 </tr>
266 <tr>
267 <td>
268 <pre>
269 a *bold* word
270
271 an __underlined__ word
272
273 ~~text in italics~~
274
275 --striked text--
276
277 &lt;tt&gt;text in monospace font&lt;/tt&gt;
278
279 Text in a &lt;sup&gt;superscript&lt;/sup&gt; format
280
281 Text in a &lt;sub&gt;subscript&lt;/sub&gt; format
282
283 {quote:http://www.xwiki.org}
284 Here is some text with a quote
285 {quote}
286 </pre>
287 </td>
288 <td>
289 a <strong class="strong">bold</strong> word<p class="paragraph"/>
290 an <span class="underline">underlined</span> word<p class="paragraph"/>
291 <em class="italic">text in italics</em><p class="paragraph"/>
292 <del class="strike">striked text</del><p class="paragraph"/>
293 <tt>text in monospace font</tt><p class="paragraph"/>
294 Text in a <sup>superscript</sup> format<p class="paragraph"/>
295 Text in a <sub>subscript</sub> format<p class="paragraph"/>
296 <blockquote class="quote"><p>
297 Here is some text with a quote
298 <a href="http://www.xwiki.org">Source</a>
299 </p></blockquote><p class="paragraph"/>
300 </td>
301 </tr>
302 </table>
303 {/pre}
304
305 1.1 Horizontal Line
306
307 {pre}
308 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
309 <tr>
310 <th>Example</th>
311 <th>Result</th>
312 </tr>
313 <tr>
314 <td>
315 <pre>
316 ----
317 </pre>
318 </td>
319 <td>
320 <hr class="line"/>
321 </td>
322 </tr>
323 </table>
324 {/pre}
325
326 1.1 Links
327
328 The full format of a link is {code}(alias[|>])(link)(@interWikiAlias)([|>]target){code}
329 * <tt>alias</tt>: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
330 * <tt>link</tt>: The full link reference using the following syntax: {code}(virtualWikiAlias:)(space.)(reference)(?queryString)(#anchor) {code}
331 * Note that either the <tt>link</tt> or the <tt>alias</tt> must be specified.
332 ** <tt>virtualWikiAlias</tt>: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
333 ** <tt>space</tt>: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
334 ** <tt>reference</tt>: The link reference. This can be either a URI in the form <tt>protocol:path</tt> (example: "http://xwiki.org", "mailto:john@smith.com") or a wiki page name (example: "WebHome").
335 ** <tt>queryString</tt>: An optional query string for specifying parameters that will be used in the rendered URL. Example: "mydata1=5&amp;mydata2=Hello".
336 ** <tt>anchor</tt>: 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".
337 * <tt>interWikiAlias</tt>: 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"
338 * <tt>target</tt>: An optional string corresponding to the HTML <tt>target</tt> attribute for a HTML <tt>a</tt> link element. This element is used when rendering the link. It defaults to opening the link in the current page. Examples: "_self", "_blank"
339
340 1.1.1 Internal Links
341
342 {pre}
343 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
344 <tr>
345 <th>Example</th>
346 <th>Result</th>
347 </tr>
348 <tr>
349 <td>
350 <pre>
351 [Colab.WebHome] (uses current space)
352 [home>Colab.WebHome] (uses current space)
353 [Colab.WebHome]
354 [home|Colab.WebHome]
355 [home>Colab.WebHome>_blank]
356 </pre>
357 {/pre}
358 </td>
359 <td>
360 [Colab.WebHome] (uses current space)<br/>
361 [home>Colab.WebHome] (uses current space)<br/>
362 [Colab.WebHome]<br/>
363 [home|Colab.WebHome]<br/>
364 [home>Colab.WebHome>_blank]
365 </td>
366 </tr>
367 </table>
368
369 1.1.1 External Links
370
371 {pre}
372 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
373 <tr>
374 <th>Example</th>
375 <th>Result</th>
376 </tr>
377 <tr>
378 <td>
379 <pre>
380 http://www.xwiki.org
381 [http://www.xwiki.org]
382 [XWiki>http://www.xwiki.org]
383 </pre>
384 </td>
385 <td>
386 <span class="nobr"><a href="http://www.xwiki.org">http://www.xwiki.org</a></span><br/>
387 <span class="wikiexternallink"><a href="http://www.xwiki.org">&#104;ttp://www.xwiki.org</a></span><br/>
388 <span class="wikiexternallink"><a href="http://www.xwiki.org">XWiki</a></span>
389 </td>
390 </tr>
391 </table>
392 {/pre}
393
394 1.1 Tables
395
396 The syntax for tables allows to easily create content in table format. It even allows to make some simple calculations on the content!
397
398 {pre}
399 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
400 <tr>
401 <th>Example</th>
402 <th>Result</th>
403 </tr>
404 <tr>
405 <td>
406 <pre>
407 {table}
408 Title 1 | Title 2
409 Word 1 | Word 2
410 {table}
411
412 {table}
413 Category | Sales (K?)
414 Category 1 | 100
415 Category 2 | 50
416 Category 3 | 50
417 Total | =sum(B2:B4)
418 {table}
419 </pre>
420 </td>
421 <td>
422 <table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
423 <tr>
424 <th>Title 1</th>
425 <th>Title 2</th>
426 </tr>
427 <tr class="table-odd">
428 <td>Word 1</td>
429 <td>Word 2</td>
430 </tr>
431 </table>
432 <table class="wiki-table" cellpadding="0" cellspacing="0" border="0">
433 <tr>
434 <th>Category</th>
435 <th>Sales (K?)</th>
436 </tr>
437 <tr class="table-odd">
438 <td>Category 1</td>
439 <td>100</td>
440 </tr>
441 <tr class="table-even">
442 <td>Category 2</td>
443 <td>50</td>
444 </tr>
445 <tr class="table-odd">
446 <td>Category 3</td>
447 <td>50</td>
448 </tr>
449 <tr class="table-even">
450 <td>Total</td>
451 <td>200</td>
452 </tr>
453 </table>
454 </td>
455 </tr>
456 </table>
457 {/pre}
458
459 1.1 Images
460
461 The <tt>\{image\}</tt> macro is used to display attachments as images. Check the [Image macro reference guide>http://code.xwiki.org/xwiki/bin/view/Macros/ImageMacro] for all options.
462
463 {pre}
464 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
465 <tr>
466 <th>Example</th>
467 <th>Result</th>
468 </tr>
469 <tr>
470 <td>
471 <pre>
472 {image:img.png}
473
474 {image:img.png|30}
475
476 {image:img.png| |20}
477
478 {image:img.png|30|20}
479 </pre>
480 </td>
481 <td>
482 <img src="$xwiki.getAttachmentURL($doc.fullName, "img.png")" alt="img.png" title="img.png"/><p class="paragraph"/>
483 <img src="$xwiki.getAttachmentURL($doc.fullName, "img.png")" height="30" alt="img.png" title="img.png"/><p class="paragraph"/>
484 <img src="$xwiki.getAttachmentURL($doc.fullName, "img.png")" width="20" alt="img.png" title="img.png"/><p class="paragraph"/>
485 <img src="$xwiki.getAttachmentURL($doc.fullName, "img.png")" height="30" width="20" alt="img.png" title="img.png"/>
486 </td>
487 </tr>
488 </table>
489 {/pre}
490
491 1.1 Escaping Text
492
493 1.1.1 Escaping a single character
494
495 {pre}
496 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
497 <tr>
498 <th>Example</th>
499 <th>Result</th>
500 </tr>
501 <tr>
502 <td>
503 <pre>
504 This is not a \[link\]
505 \#set (\$var = "something")
506 </pre>
507 </td>
508 <td>
509 This is not a &#91;link&#93;<br />
510 \#set (\$var = &#34;something&#34;)
511 </td>
512 </tr>
513 </table>
514 {/pre}
515
516 1.1.1 Escaping wiki syntax rendering
517
518 The <tt>{&#112;re}{/&#112;re}</tt> macro prevents wiki syntax and Radeox macro rendering but preserves HTML rendering and preserves execution of Groovy/Velocity scripts.
519
520 {pre}
521 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
522 <tr>
523 <th>Example</th>
524 <th>Result</th>
525 </tr>
526 <tr>
527 <td>
528 <pre>
529 {&#112;re}
530 No *bold rendering* in wiki syntax.
531 {/&#112;re}
532 </pre>
533 </td>
534 <td>
535 No *bold rendering* in wiki syntax.
536 </td>
537 </tr>
538 </table>
539 {/pre}
540
541 1.1.1 Escaping everything
542
543 The <tt>\{code\}\{code\}</tt> macro prevents wiki syntax rendering, HTML rendering and Groovy/Velocity rendering. Check the [Code macro reference guide>http://code.xwiki.org/xwiki/bin/view/Macros/CodeMacro] for all options.
544
545 {pre}
546 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
547 <tr>
548 <th>Example</th>
549 <th>Result</th>
550 </tr>
551 <tr>
552 <td>
553 <pre>
554 {code}
555 No &lt;strong&gt;bold rendering&lt;/strong&gt; in HTML.
556 No *bold rendering in* wiki syntax.
557 {code}
558 </pre>
559 </td>
560 <td>
561 <div class="code">
562 <pre>No &#60;strong&#62;bold rendering&#60;/strong&#62; in HTML.
563 No &#42;bold rendering in&#42; wiki syntax.</pre>
564 </div>
565 </td>
566 </tr>
567 </table>
568 {/pre}
569
570 1.1 Boxes
571
572 Boxes are a nice way to improve on the visual presentation and highlight important elements. The reference documentation for the macros shown below can be found here:
573 * [Info Macro>http://code.xwiki.org/xwiki/bin/view/Macros/InfoMacro]
574 * [Warning Macro>http://code.xwiki.org/xwiki/bin/view/Macros/WarningMacro]
575 * [Error Macro>http://code.xwiki.org/xwiki/bin/view/Macros/ErrorMacro]
576 * [Floating Box Macro>http://code.xwiki.org/xwiki/bin/view/Macros/FloatingBoxMacro]
577 * [Style Macro>http://code.xwiki.org/xwiki/bin/view/Macros/StyleMacro]
578
579 {pre}
580 <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%">
581 <tr>
582 <th>Example</th>
583 <th>Result</th>
584 </tr>
585 <tr>
586 <td>
587 <pre>
588 \#info("This is an information panel")
589
590 \#warning("This is a warning panel")
591
592 \#error("This is an error panel")
593
594 \#startfloatingbox()
595 Some content in a floating box
596 \#endfloatingbox()
597 This is a floating box displayed on the right.
598
599 \#floatingbox("Some content in a floating box")
600 This is also a floating box displayed on the right.
601
602 {style:type=div|border=1px solid red|background-color=grey|width=300px|height=300px|color=red}
603 This is some content...
604 {style}
605 </pre>
606 </td>
607 <td>
608 <div class="infomessage">This is an information panel</div>
609 <div class="warningmessage"><span class="messagetype">Warning: </span>This is a warning panel</div>
610 <div class="errormessage"><span class="messagetype">Error: </span>This is an error panel</div>
611 <br /><br />
612 <fieldset class="floatinginfobox">
613 <legend/>
614 Some content in a floating box
615 </fieldset>
616 This is a floating box displayed on the right.<p class="paragraph"/>
617 <fieldset class="floatinginfobox"><legend/>Some content in a floating box</fieldset>
618 This is also a floating box displayed on the right.<p class="paragraph"/>
619 <div style="color:white; background-color:grey; width:150px; height:50px; border:1px solid black; " >
620 This is some content&#8230;
621 </div>
622 </td>
623 </tr>
624 </table>
625 {/pre}
626
627 1.1 Other Macros
628
629 *XWiki boasts a [lot of other very useful macros>http://code.xwiki.org/xwiki/bin/view/Macros/WebHome]*.
630
631 #info("Make sure to check also our [Code Zone>http://code.xwiki.org/xwiki/bin/view/Main/WebHome] as we also have [Plugins>http://code.xwiki.org/xwiki/bin/view/Plugins/WebHome], [Code Snippets>http://code.xwiki.org/xwiki/bin/view/Snippets/WebHome], [Applications>http://code.xwiki.org/xwiki/bin/view/Applications/WebHome] and [Extensions>http://code.xwiki.org/xwiki/bin/view/Extensions/WebHome].")
#getBlogDocument($space $blogDoc)