XWikiSyntax
Modifié par Administrator le 2009/12/22 09:35
XWiki Syntax
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.
Titles
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> 1 Title 1 1.1 Title 2 1.1.1 Title 3 1.1.1.1 Title 4 1.1.1.1.1 Title 5 1.1.1.1.1.1 Title 6 </pre> </td> <td> <h2><span id="HTitle1">Title 1</span></h2><p class="paragraph"/> <h3><span id="HTitle2">Title 2</span></h3><p class="paragraph"/> <h4><span id="HTitle3">Title 3</span></h4><p class="paragraph"/> <h5><span id="HTitle4">Title 4</span></h5><p class="paragraph"/> <h6><span id="HTitle5">Title 5</span></h6><p class="paragraph"/> <h6><span id="HTitle6">Title 6</span></h6><p class="paragraph"/> </td> </tr> </table>
Paragraphs
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> Here is a paragraph. This text continues the same paragraph. This paragraph is a new one. This paragraph is another new one. This paragraph is displayed\ on two lines. </pre> </td> <td> Here is a paragraph. 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"/> This paragraph is displayed<br/>on two lines. </td> </tr> </table>
Lists
Bulleted Lists
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> * Item 1 ** Item 2 *** Item 3 * Item 4 </pre> </td> <td> <ul class="star"> <li>Item 1 <ul class="star"> <li>Item 2 <ul class="star"> <li>Item 3</li> </ul> </li> </ul> </li> <li>Item 4</li> </ul> </td> </tr> </table>
Numbered Lists
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> 1. Item 1 11. Item 2 111. Item 3 1. Item 4 1. Item 1 1*. Item 2 1*. Item 3 1. Item 4 a. Alphabetical enumerated list a. Alphabetical enumerated list A. Uppercase alphabetical enumerated list A. Uppercase alphabetical enumerated list i. Roman enumerated list i. Roman enumerated list I. Uppercase roman enumerated list I. Uppercase roman enumerated list g. Greek enumerated list g. Greek enumerated list h. Hirigana (jap.) enumerated list h. Hirigana (jap.) enumerated list k. Katakana (jap.) enumerated list k. Katakana (jap.) enumerated list </pre> </td> <td> <ol> <li>Item 1 <ol> <li>Item 2 <ol> <li>Item 3</li> </ol> </li> </ol> </li> <li>Item 4</li> </ol> <ol> <li>Item 1 <ul class="star"> <li>Item 2</li> <li>Item 3</li> </ul> </li> <li>Item 4</li> </ol> <ol class="alpha"> <li>Alphabetical enumerated list</li> <li>Alphabetical enumerated list</li> </ol> <ol class="ALPHA"> <li>Uppercase alphabetical enumerated list</li> <li>Uppercase alphabetical enumerated list</li> </ol> <ol class="roman"> <li>Roman enumerated list</li> <li>Roman enumerated list</li> </ol> <ol class="ROMAN"> <li>Uppercase roman enumerated list</li> <li>Uppercase roman enumerated list</li> </ol> <ol class="greek"> <li>Greek enumerated list</li> <li>Greek enumerated list</li> </ol> <ol class="hiragana"> <li>Hirigana (jap.) enumerated list</li> <li>Hirigana (jap.) enumerated list</li> </ol> <ol class="katakana"> <li>Katakana (jap.) enumerated list</li> <li>Katakana (jap.) enumerated list</li> </ol> </td> </tr> </table>
Definition Lists
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> <dl> <dt>Term</dt> <dd>Definition</dd> </dl> </pre> </td> <td> <dl> <dt>Term</dt> <dd>Definition</dd> </dl> </td> </tr> </table>
Text Styles
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> a *bold* word an __underlined__ word ~~text in italics~~ --striked text-- <tt>text in monospace font</tt> Text in a <sup>superscript</sup> format Text in a <sub>subscript</sub> format {quote:http://www.xwiki.org} Here is some text with a quote {quote} </pre> </td> <td> a <strong class="strong">bold</strong> word<p class="paragraph"/> an <span class="underline">underlined</span> word<p class="paragraph"/> <em class="italic">text in italics</em><p class="paragraph"/> <del class="strike">striked text</del><p class="paragraph"/> <tt>text in monospace font</tt><p class="paragraph"/> Text in a <sup>superscript</sup> format<p class="paragraph"/> Text in a <sub>subscript</sub> format<p class="paragraph"/> <blockquote class="quote"><p> Here is some text with a quote <a href="http://www.xwiki.org">Source</a> </p></blockquote><p class="paragraph"/> </td> </tr> </table>
Horizontal Line
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> ---- </pre> </td> <td> <hr class="line"/> </td> </tr> </table>
Links
The full format of a link is
(alias[|>])(link)(@interWikiAlias)([|>]target)
- alias: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
- link: The full link reference using the following syntax:
(virtualWikiAlias:)(space.)(reference)(?queryString)(#anchor)
- Note that either the link or the alias must be specified.
- virtualWikiAlias: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
- space: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
- reference: The link reference. This can be either a URI in the form protocol:path (example: "http://xwiki.org", "john@smith.com") or a wiki page name (example: "WebHome").
- queryString: An optional query string for specifying parameters that will be used in the rendered URL. Example: "mydata1=5&mydata2=Hello".
- 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".
- interWikiAlias: An optional Inter Wiki alias as defined in the InterWiki Map (see the Admin Guide). Example: "wikipedia"
- 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"
Internal Links
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> [Colab.WebHome] (uses current space) [home>Colab.WebHome] (uses current space) [Colab.WebHome] [home|Colab.WebHome] [home>Colab.WebHome>_blank] </pre>home (uses current space)
Colab
home
home
External Links
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> http://www.xwiki.org [http://www.xwiki.org] [XWiki>http://www.xwiki.org] </pre> </td> <td> <span class="nobr"><a href="http://www.xwiki.org">http://www.xwiki.org</a></span><br/> <span class="wikiexternallink"><a href="http://www.xwiki.org">http://www.xwiki.org</a></span><br/> <span class="wikiexternallink"><a href="http://www.xwiki.org">XWiki</a></span> </td> </tr> </table>
Tables
The syntax for tables allows to easily create content in table format. It even allows to make some simple calculations on the content! <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> {table} Title 1 | Title 2 Word 1 | Word 2 {table} {table} Category | Sales (K?) Category 1 | 100 Category 2 | 50 Category 3 | 50 Total | =sum(B2:B4) {table} </pre> </td> <td> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"> <tr> <th>Title 1</th> <th>Title 2</th> </tr> <tr class="table-odd"> <td>Word 1</td> <td>Word 2</td> </tr> </table> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"> <tr> <th>Category</th> <th>Sales (K?)</th> </tr> <tr class="table-odd"> <td>Category 1</td> <td>100</td> </tr> <tr class="table-even"> <td>Category 2</td> <td>50</td> </tr> <tr class="table-odd"> <td>Category 3</td> <td>50</td> </tr> <tr class="table-even"> <td>Total</td> <td>200</td> </tr> </table> </td> </tr> </table>Images
The <table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> {image:img.png} {image:img.png|30} {image:img.png| |20} {image:img.png|30|20} </pre> </td> <td> <img src="/xwiki/bin/downloadrev/XWiki/XWikiSyntax/img.png?rev=1.1" alt="img.png" title="img.png"/><p class="paragraph"/> <img src="/xwiki/bin/downloadrev/XWiki/XWikiSyntax/img.png?rev=1.1" height="30" alt="img.png" title="img.png"/><p class="paragraph"/> <img src="/xwiki/bin/downloadrev/XWiki/XWikiSyntax/img.png?rev=1.1" width="20" alt="img.png" title="img.png"/><p class="paragraph"/> <img src="/xwiki/bin/downloadrev/XWiki/XWikiSyntax/img.png?rev=1.1" height="30" width="20" alt="img.png" title="img.png"/> </td> </tr> </table>Escaping Text
Escaping a single character
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> This is not a [link] #set ($var = "something") </pre> </td> <td> This is not a [link]<br /> #set ($var = "something") </td> </tr> </table>
Escaping wiki syntax rendering
The {pre}{/pre} macro prevents wiki syntax and Radeox macro rendering but preserves HTML rendering and preserves execution of Groovy/Velocity scripts.
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> {pre} No *bold rendering* in wiki syntax. {/pre} </pre> </td> <td> No *bold rendering* in wiki syntax. </td> </tr> </table>
Escaping everything
The {code}{code} macro prevents wiki syntax rendering, HTML rendering and Groovy/Velocity rendering. Check the Code macro reference guide for all options.
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> {{code}} No <strong>bold rendering</strong> in HTML. No *bold rendering in* wiki syntax. {{/code}} </pre> </td> <td> <div class="code"> <pre>No <strong>bold rendering</strong> in HTML. No *bold rendering in* wiki syntax.</pre> </div> </td> </tr> </table>
Boxes
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:
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> #info("This is an information panel") #warning("This is a warning panel") #error("This is an error panel") #startfloatingbox() Some content in a floating box #endfloatingbox() This is a floating box displayed on the right. #floatingbox("Some content in a floating box") This is also a floating box displayed on the right. {style:type=div|border=1px solid red|background-color=grey|width=300px|height=300px|color=red} This is some content... {style} </pre> </td> <td> <div class="infomessage">This is an information panel</div> <div class="warningmessage"><span class="messagetype">Warning: </span>This is a warning panel</div> <div class="errormessage"><span class="messagetype">Error: </span>This is an error panel</div> <br /><br /> <fieldset class="floatinginfobox"> <legend/> Some content in a floating box </fieldset> This is a floating box displayed on the right.<p class="paragraph"/> <fieldset class="floatinginfobox"><legend/>Some content in a floating box</fieldset> This is also a floating box displayed on the right.<p class="paragraph"/> <div style="color:white; background-color:grey; width:150px; height:50px; border:1px solid black; " > This is some content… </div> </td> </tr> </table>
Other Macros
XWiki boasts a lot of other very useful macros.