Changes for page XWiki Syntax Guide

Last modified by Administrator on 2011/03/03 00:17

From version Icon 2.1 Icon
edited by Administrator
on 2011/03/03 07:17
Change comment: Imported from XAR
To version Icon 3.1
edited by Administrator
on 2011/03/03 00:17
Change comment: Install extension [org.xwiki.platform:xwiki-platform-help-ui/17.10.15]

Summary

Details

Icon Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -XWiki Syntaxes
1 +$services.localization.render("help.syntaxpage.title")
Parent
... ... @@ -1,1 +1,1 @@
1 -XWiki.WebHome
1 +Main.WebHome
Default language
... ... @@ -1,1 +1,0 @@
1 -en
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Content
... ... @@ -1,787 +1,334 @@
1 -{{box cssClass="floatinginfobox" title="**Contents**"}}{{toc depth="1"/}}{{/box}}
1 +{{velocity output="false"}}
2 +#set($SUPPORTED_SYNTAXES = {})
3 +#set($void = $SUPPORTED_SYNTAXES.put('1.0', 'XWiki Syntax 1.0'))
4 +#set($void = $SUPPORTED_SYNTAXES.put('2.0', 'XWiki Syntax 2.0'))
5 +#set($void = $SUPPORTED_SYNTAXES.put('2.1', 'XWiki Syntax 2.1'))
6 +##
7 +## needed for sections that contain descriptions valid for several syntaxes
8 +## basically it is hack to reuse the 2.0 descriptions for 2.1
9 +#set($SUPPORTED_SYNTAX_ORDER = ['1.0', '2.0', '2.1'])
10 +##
11 +## filter all syntaxes that are not installed/configured
12 +#set($configuredSyntaxes = $services.rendering.getConfiguredSyntaxes())
13 +#set($enabledSyntaxIds = [])
14 +#foreach($syntax in $configuredSyntaxes)
15 + #set($discard = $enabledSyntaxIds.add($syntax.toIdString()))
16 +#end
17 +#set($unavailableSyntaxes=[])
18 +#foreach($supportedSyntax in $SUPPORTED_SYNTAX_ORDER)
19 + #set($fullSyntaxId = "xwiki/$supportedSyntax")
20 + #if(!$enabledSyntaxIds.contains($fullSyntaxId))
21 + #set($discard = $unavailableSyntaxes.add($supportedSyntax))
22 + #end
23 +#end
24 +#foreach($unavailableSyntax in $unavailableSyntaxes)
25 + #set($discard = $SUPPORTED_SYNTAX_ORDER.remove($unavailableSyntax))
26 + #set($discard = $SUPPORTED_SYNTAXES.removeKey($unavailableSyntax))
27 +#end
2 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.
29 +#if ($request.xaction == 'switchContext')
30 + $response.sendRedirect($request.target)
31 + #stop
32 +#end
8 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]]
34 +#set ($crtCategoryId = "$!{request.category}")
35 +#if ($crtCategoryId != '')
36 + #set ($crtCategoryId = $numbertool.toNumber($crtCategoryId).intValue())
37 +#end
38 +#set ($crtSectionId = "$!{request.section}")
39 +#set ($crtSyntaxVer = "$!{request.syntax}")
40 +#if (!$SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer))
41 + ## Default to the most current one (if we have any)
42 + #if(!$SUPPORTED_SYNTAX_ORDER.isEmpty())
43 + #set ($crtSyntaxVer = $SUPPORTED_SYNTAX_ORDER.get($mathtool.sub($SUPPORTED_SYNTAX_ORDER.size(),1)))
44 + #end
45 +#end
46 +#set($crtSyntaxPos = $SUPPORTED_SYNTAX_ORDER.indexOf($crtSyntaxVer))
10 10  
11 -= General Remarks =
48 +#set ($extraParamList = [])
49 +#if ($request.language)
50 + #set ($discard = $extraParamList.add("language=$escapetool.url($request.language)"))
51 +#end
52 +#if ($request.xpage)
53 + #set ($discard = $extraParamList.add("xpage=$escapetool.url($request.xpage)"))
54 +#end
55 +#if ($extraParamList.isEmpty())
56 + #set ($extraParams = '')
57 +#else
58 + #set ($extraParams = '&'+$stringtool.join($extraParamList,'&'))
59 +#end
12 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.
61 +##
62 +## Syntax menu map
63 +##
64 +#set($syntaxMenu = [])
65 +#set($catCount = -1)
66 +#set($catName = "")
67 +#set($catChildren = [])
68 +#set($results = $services.query.xwql('from doc.object(XWiki.XWikiSyntaxClass) as syntax order by syntax.category, syntax.section').addFilter('currentlanguage').addFilter('unique').execute())
14 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 heading syntax|{{{=== heading}}}|{{{=== heading ===}}}
70 +#if($results.empty)
71 + No syntax sections found!
72 +#else
73 + #foreach ($item in $results)
74 + #set($sectionDoc = $xwiki.getDocument($item))
75 + #set($obj = $sectionDoc.getObject("XWiki.XWikiSyntaxClass"))
21 21  
22 -= Paragraphs =
77 + ## detect if we entered a new category
78 + #if($catCount < $obj.getProperty("category").value)
79 + ## Put previous category into map (if existing), and reset children map
80 + #if($catId)
81 + #set($cat = { 'id' : $catId, 'name' : $catName, 'children' : $catChildren })
82 + $syntaxMenu.add($cat)
83 + #set($catChildren = [])
84 + #end
85 + ## extract new catId and catName values, and sectionTitle as we are already traveling the DOM
86 + #foreach($headerBlock in $sectionDoc.getDocument().getXDOM().getBlocks('class:HeaderBlock', 'DESCENDANT'))
87 + #if($headerBlock.getLevel().getAsInt() == 1)
88 + #set($catId = $headerBlock.getId().substring(1))
89 + #set($catName = $services.rendering.render($headerBlock, 'plain/1.0'))
90 + #elseif($headerBlock.getLevel().getAsInt() == 2)
91 + #set($sectionTitle = $services.rendering.render($headerBlock, 'plain/1.0'))
92 + #break
93 + #end
94 + #end
95 + #foreach($headerBlock in $sectionDoc.getTranslatedDocument().getDocument().getXDOM().getBlocks('class:HeaderBlock', 'DESCENDANT'))
96 + #if($headerBlock.getLevel().getAsInt() == 1)
97 + #set($catName = $services.rendering.render($headerBlock, 'plain/1.0'))
98 + #elseif($headerBlock.getLevel().getAsInt() == 2)
99 + #set($sectionTitle = $services.rendering.render($headerBlock, 'plain/1.0'))
100 + #break ## otherwise finds nested example headlines
101 + #end
102 + #end
103 + #set($catCount = $obj.getProperty("category").value)
104 + #else
105 + ## still in same category, only need new section title
106 + #foreach($headerBlock in $sectionDoc.getTranslatedDocument().getDocument().getXDOM().getBlocks('class:HeaderBlock', 'DESCENDANT'))
107 + #if($headerBlock.getLevel().getAsInt() == 2)
108 + #set($sectionTitle = $services.rendering.render($headerBlock, 'plain/1.0'))
109 + #break
110 + #end
111 + #end
112 + #end
23 23  
24 -Paragraphs are text elements separated by 2 or more new lines.
114 + ## Add new sections to category children map
115 + #set($child = {'id' : $sectionDoc.documentReference.name.substring(11), 'minSyntax' : $obj.getProperty("minSyntaxId").value, 'maxSyntax' : $obj.getProperty("maxSyntaxId").value, 'name' : $sectionTitle})
116 + $catChildren.add($child)
117 + #end
118 +#end
119 +#set($cat = { 'id' : $catId, 'name' : $catName, 'children' : $catChildren })
120 +$syntaxMenu.add($cat)
25 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 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
123 +##
124 +## Filter only the sections that are valid for a Syntax
125 +##
126 +#set ($categoriesToRemove = [])
127 +#foreach ($category in $syntaxMenu)
128 + #set ($sectionsToRemove = [])
129 + #foreach ($section on $category.children)
130 + #set($minSyntaxPos = $SUPPORTED_SYNTAX_ORDER.indexOf($section.minSyntax))
131 + #if ($minSyntaxPos > $crtSyntaxPos)
132 + #set ($discard = $sectionsToRemove.add($section))
133 + #if ($section.id == $crtSectionId)
134 + #set ($crtSectionId = '') ## clear section if it doesn't exist (can happen when switching from 2.x to 1.0 syntax)
135 + #end
136 + #end
137 + #end
138 + #set ($discard = $category.children.removeAll($sectionsToRemove))
139 + #if ($category.children.size() == 0)
140 + #set ($discard = $categoriesToRemove.add($category))
141 + #end
142 +#end
143 +#set ($discard = $syntaxMenu.removeAll($categoriesToRemove))
144 +#if ("$!crtCategoryId" != '' && $crtCategoryId >= $syntaxMenu.size())
145 + #set ($crtCategoryId = '')
146 +#end
36 36  
37 -= Headings =
148 +#if ($crtSectionId != '')
149 + #set ($crtItemId = $crtSectionId)
150 +#elseif ($crtCategoryId != '')
151 + #set ($crtItemId = $syntaxMenu.get($crtCategoryId).id)
152 +#end
153 +#set ($crtSection = $util.null)
154 +#set ($crtCategory = $util.null)
38 38  
39 -(% style="width:100%" %)
40 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
41 -|Standard headings|(((
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 headings|<h1><span style="color:blue">heading</span></h1>|{{{(% style="color:blue" %)}}}\\= heading =|(((
61 -{{html}}
62 -<h1 id="Hheading" style="color:blue"><span>heading</span></h1>
63 -{{/html}})))
64 -|Headings with wiki syntax|1.1.1 Heading with *bold*|{{{=== Heading with **bold** ===}}}|(((=== Heading with **bold** ===)))
65 65  
66 -= Text Formatting =
157 +##
158 +## Prepare the Syntax menu map for processing
159 +##
160 +#foreach ($category in $syntaxMenu)
161 + ## "Standard" URLs and icons for categories
162 + #set ($category.url = "?syntax=$escapetool.url(${crtSyntaxVer})&category=${mathtool.sub($foreach.count, 1)}${extraParams}")
163 + #set ($category.cssClass = "${category.id}Icon")
164 + #if ("$!{crtCategoryId}" != '' && $foreach.count == $mathtool.add($crtCategoryId, 1))
165 + #set ($crtCategory = $category)
166 + #end
167 + ##
168 + ## Process each syntax section
169 + #foreach ($section in $category.children)
170 + #if ($xwiki.exists("XWiki.XWikiSyntax${section.id}"))
171 + #if ($crtSectionId == $section.id)
172 + #set ($crtSection = $section)
173 + #set ($crtCategory = $category)
174 + #end
175 + #set ($section.url = "?syntax=$escapetool.url(${crtSyntaxVer})&section=$escapetool.url(${section.id})${extraParams}")
176 + #end
177 + #end
178 +#end
67 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}}
180 +#**
181 + * Displays the sections from a syntax category
182 + *
183 + * Expected format:
184 + * sections = vector of items
185 + * item = map with the following fields:
186 + * 'id' : mandatory
187 + * 'name' : the text displayed for the corresponding menu item;
188 + * optional, defaults to
189 + * $services.localization.render("$!{translationPrefix}${item.id}")
190 + *
191 + * @param $sections the sections list, in the format described above
192 + * @param $translationPrefix the translation prefix added to the id of each
193 + * item, in order to generate the name and description; ignored when
194 + * name or description are specified
195 + * @param $heading the heading syntax
196 + *#
197 +#macro(syntax_displayCategory $sections $translationPrefix $heading)
198 + #foreach ($section in $sections)
199 + #syntax_displaySection($section $translationPrefix $heading)
200 + #end
201 +#end
74 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,,
203 +#macro(syntax_displaySection $section $translationPrefix $heading)
204 + #set ($displayVersion = $crtSyntaxVer)
205 + ## here is the hack to display the description for 2.0 if we have no description for 2.x
206 + ## this likely needs more work if e.g. there is a 3.x which is not compatible with 2.x
207 + #set($maxSyntaxPos = $SUPPORTED_SYNTAX_ORDER.indexOf($section.maxSyntax))
208 + #if ($crtSyntaxPos > $maxSyntaxPos)
209 + #set ($displayVersion = $section.maxSyntax)
210 + #end
211 + #if($heading)
212 + (% class="sectionheader" %)
213 + $heading $services.rendering.escape($section.name, 'xwiki/2.1') $heading
84 84  
85 -= Horizontal Line =
215 + #end
216 + ## Escape the values used as macro parameters.
217 + #set ($includeReference = $services.rendering.escape("XWiki.XWikiSyntax${section.id}", 'xwiki/2.1'))
218 + #set ($includeSection = $services.rendering.escape("H${displayVersion}${section.id}", 'xwiki/2.1'))
219 + {{include reference="$includeReference" section="$includeSection"/}}
220 +#end
86 86  
87 -{{info}}There must be 4 or more dashes.{{/info}}
88 88  
89 -{{info}}Note that this is different from Creole where exactly 4 dashes are required.{{/info}}
223 +#**
224 + * Displays the syntax categories
225 + *
226 + * Expected format:
227 + * sections = vector of items
228 + * item = map with the following fields:
229 + * 'id' : mandatory
230 + * 'name' : the text displayed for the corresponding menu item;
231 + * optional, defaults to
232 + * $services.localization.render("$!{translationPrefix}${item.id}")
233 + *
234 + * @param $sections the sections list, in the format described above
235 + * @param $translationPrefix the translation prefix added to the id of each
236 + * item, in order to generate the name and description; ignored when
237 + * name or description are specified
238 + *#
239 +#macro(syntax_displayCategories $syntaxMenu $translationPrefix)
240 + #set ($subHeading = '====')
241 + #foreach ($category in $syntaxMenu)
242 + == $services.rendering.escape($category.name, 'xwiki/2.1') ==
90 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 -)))
244 + #syntax_displayCategory($category.children 'syntax.' '===')
245 + #end
246 +#end
101 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 an attachment in the current page|(((
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 -|Link to an attachment in a different page|(((
442 -{{info}}See [[Attach Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/AttachMacro]] for details{{/info}}
443 -{{{{attach:text|document=Space.Page|file=img.png}}}}
444 -)))|{{{[[text>>attach:Space.Page@img.png]]}}}|[[text>>attach:XWiki.XWikiSyntax@img.png]]|[[text>>attach:XWiki.XWikiSyntax@img.png]]
445 -
446 -== XWiki Syntax 1.0 Link Specification ==
447 -
448 -The full format of a link is ##(alias[|&gt;])+(link)(@interWikiAlias)+([|&gt;]target)+##
449 -* ##alias##: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
450 -* ##link##: The full link reference using the following syntax: ##(virtualWikiAlias:)+(space.)+(reference)(?queryString)+(#anchor)+##
451 -* Note that either the ##link## or the ##alias## must be specified.
452 -** ##virtualWikiAlias##: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
453 -** ##space##: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
454 -** ##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").
455 -** ##queryString##: An optional query string for specifying parameters that will be used in the rendered URL. Example: {{{"mydata1=5&amp;mydata2=Hello"}}}.
456 -** ##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".
457 -* ##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"
458 -* ##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"
459 -
460 -== XWiki Syntax 2.0 Link Specification ==
461 -
462 -The full format of a link is ##(label>>)?(link)(||parameters)*##
463 -* ##label##: the link label, can contain wiki syntax
464 -* ##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.
465 -* ##parameters##: An optional list of parameters passed to the link.
466 -
467 -= Tables =
468 -
469 -Allows to easily create content in table format. It also support parameters for table, row or cell in XWiki Syntax 2.0.
470 -
471 -(% style="width:100%" %)
472 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
473 -|Standard table|{{{(((
474 -{table}
475 -Title 1 | Title 2
476 -Word 1 | Word 2
477 -{table}
478 -)))}}}|((({{{
479 -|=Title 1|=Title 2
480 -|Word 1|Word 2
481 -}}}))) or ((({{{
482 -!=Title 1!=Title 2
483 -!!Word 1!!Word 2
484 -}}})))|(((
485 -|=Title 1|=Title 2
486 -|Word 1|Word 2
487 -)))
488 -|Parametrized table|(((
489 -<table style="background-color:red;align:center">
490 - <tbody>
491 - <tr>
492 - <td>Title 1</td>
493 - <td style="background-color:yellow">Title 2</td>
494 - </tr>
495 - <tr>
496 - <td>Word 1</td>
497 - <td>Word 2</td>
498 - </tr>
499 - </tbody>
500 -</table>
501 -)))|((({{{
502 -(% style="background-color:red;align=center" %)
503 -|=Title 1|=(% style="background-color:yellow" %)Title 2
504 -|Word 1|Word 2
505 -}}})))|(((
506 -(% style="background-color:red;align=center" %)
507 -|=Title 1|=(% style="background-color:yellow" %)Title 2
508 -|Word 1|Word 2
509 -)))
510 -|Filterable Sortable table|((({{{
511 -$xwiki.ssfx.use("js/xwiki/table/table.css")
512 -$xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
513 -<table id="tableid" class="grid sortable filterable doOddEven">
514 - <tr class="sortHeader">
515 - <th>Title1</th>
516 - <th>Title2</th>
517 - </tr>
518 - <tr>
519 - <td>Cell11</td>
520 - <td>Cell12</td>
521 - </tr>
522 - <tr>
523 - <td>Cell21</td>
524 - <td>Cell22</td>
525 - </tr>
526 -</table>
527 -}}})))|((({{{
528 -{{velocity}}
529 -$xwiki.ssfx.use("js/xwiki/table/table.css")
530 -$xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
531 -{{/velocity}}
532 -
248 +#**
249 + * Displays the drop down allowing to switch the syntax.
250 + *#
251 +#macro (syntaxSwitch)
252 + #set ($crtSelection = "")
253 + #if ("$!{crtCategoryId}" != '')
254 + #set ($crtSelection = "category=$escapetool.url($!{crtCategoryId})")
255 + #elseif ($crtSectionId != '')
256 + #set ($crtSelection = "section=$escapetool.url($!{crtSectionId})")
257 + #end
258 + #if ($crtSelection != "")
259 + #set ($crtSelection = "${crtSelection}${extraParams}")
260 + #else
261 + #set ($crtSelection = "$extraParams")
262 + #end
533 533  {{html}}
534 -<table id="tableid" class="grid sortable filterable doOddEven">
535 - <tr class="sortHeader">
536 - <th>Title1</th>
537 - <th>Title2</th>
538 - </tr>
539 - <tr>
540 - <td>Cell11</td>
541 - <td>Cell12</td>
542 - </tr>
543 - <tr>
544 - <td>Cell21</td>
545 - <td>Cell22</td>
546 - </tr>
547 -</table>
548 -{{/html}}}}})))|(((
549 -{{velocity}}
550 -$xwiki.ssfx.use("js/xwiki/table/table.css")
551 -$xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
264 + <form id="change-context" class="xformInline" action="$doc.getURL()">
265 + <div>
266 + <input type="hidden" name="xaction" value="switchContext" />
267 + #if ($request.language)
268 + <input type="hidden" name="language" value="$escapetool.xml($request.language)" />
269 + #end
270 + #if ($request.xpage)
271 + <input type="hidden" name="xpage" value="$escapetool.xml($request.xpage)" />
272 + #end
273 + <select id="goto-select" name="target" title="$escapetool.xml($services.localization.render("help.changesyntax"))">
274 + <optgroup label="$services.localization.render('help.choose_syntax')">
275 + #foreach($syntaxId in $SUPPORTED_SYNTAX_ORDER)
276 + #set ($query = "syntax=${escapetool.url($syntaxId)}&${crtSelection}")
277 + <option value="$escapetool.xml($doc.getURL('view', $query))"#if($crtSyntaxVer == $syntaxId) selected="selected"#end>$escapetool.html($SUPPORTED_SYNTAXES.get($syntaxId))</option>
278 + #end
279 + </optgroup>
280 + </select>
281 + <span class="buttonwrapper"><input type="submit" value="$escapetool.xml($services.localization.render('admin.switchContext'))" class="button" /></span>
282 + </div>
283 + </form>
284 +{{/html}}
285 +#end
552 552  {{/velocity}}
553 553  
554 -{{html}}
555 -<table id="tableid" class="grid sortable filterable doOddEven">
556 - <tr class="sortHeader">
557 - <th>Title1</th>
558 - <th>Title2</th>
559 - </tr>
560 - <tr>
561 - <td>Cell11</td>
562 - <td>Cell12</td>
563 - </tr>
564 - <tr>
565 - <td>Cell21</td>
566 - <td>Cell22</td>
567 - </tr>
568 -</table>
569 -{{/html}})))
570 -
571 -= Images =
572 -
573 -(% style="width:100%" %)
574 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
575 -|Image from attachment in current page|(((
576 -{{info}}See [[Image Macro>>http://code.xwiki.org/xwiki/bin/view/Macros/ImageMacro]] for details{{/info}}
577 -{{{{image:img.png}}}}
578 -)))|{{{image:img.png}}}|image:img.png
579 -|Image from attachment in another document|{{{{image:img.png|document=Space.Page}}}}|{{{image:Space.Page@img.png}}}|image:img.png
580 -|Image with parameters|{{{{image:img.png|width=25|height=25}}}}|{{{[[image:img.png||width="25" height="25"]]}}}|[[image:img.png||width="25" height="25"]]
581 -|Images located at URL|{{{http://some/url/img.png}}}|{{{image:http://some/url/img.png}}}|image:img.png
582 -
583 -= Verbatim =
584 -
585 -Allow to enter content that will not be formatted (in other words the wiki syntax will not be taken into account).
586 -
587 -{{info}}
588 -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.
589 -{{/info}}
590 -
591 -(% style="width:100%" %)
592 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
593 -|Verbatim inline|{{{Some verbatim {pre}*[not rendered]*{/pre} content}}}|{{{Some verbatim {{{**[[not rendered]]**}}} content}}}|Some verbatim {{{*[not rendered]*}}} content|Some verbatim {{{**[[not rendered]]**}}} content
594 -|Verbatim block|((({{{
595 -{pre}
596 -multi line
597 -*verbatim*
598 -content
599 -{/pre}
600 -}}}
601 -{{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}}
602 -)))|((({{{
603 -{{{
604 -multi line
605 -**verbatim**
606 -content
607 -}}}
608 -}}})))|((({{{
609 -multi line
610 -*verbatim*
611 -content
612 -}}})))|((({{{
613 -multi line
614 -**verbatim**
615 -content
616 -}}})))
617 -
618 -= Quotations =
619 -
620 -Allows to quote some text.
621 -
622 -(% style="width:100%" %)
623 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
624 -|Simple quote|(((
625 -<blockquote><p>john said this</p></blockquote>
626 -I said ok
627 -)))|((({{{
628 -> john said this
629 -I said ok
630 -}}})))|(((
631 -> john said this
632 -I said ok
288 +{{velocity}}
289 +##**************************************************************************************************
290 +## From the Administration Sheet, used to display a common UI for some wiki features
291 +## here used to display all categories / sections of the syntax guide
292 +##**************************************************************************************************
293 +$xwiki.get('jsx').use($doc.getFullName())##
294 +$xwiki.get('ssx').use($doc.getFullName())##
295 +#if ($crtSectionId != '')
296 + #set ($sectionName = ${crtSection.name})
297 +#elseif ($crtCategoryId != '')
298 + #set ($sectionName = ${crtCategory.name})
299 +#else
300 + #set ($sectionName = $services.localization.render("help.syntaxall"))
301 +#end
302 +#set ($syntaxTitle = $services.localization.render("help.syntaxtitle", ["${crtSyntaxVer}"]))
303 +#syntaxSwitch()
304 +(((
305 +#set ($query = "syntax=$escapetool.url(${crtSyntaxVer})${extraParams}")
306 +#if ($crtCategory)
307 + {{html}}<a href="${doc.getURL('view', ${query})}">$syntaxTitle</a>{{/html}} » ##
308 + #if ($crtSection)
309 + {{html}}<a href="${crtCategory.url}">$escapetool.xml($crtCategory.name)</a>{{/html}} » ##
310 + (% class="current" %)$services.rendering.escape($crtSection.name, 'xwiki/2.1')
311 + #else
312 + (% class="current" %)$services.rendering.escape($crtCategory.name, 'xwiki/2.1')
313 + #end
314 +#else
315 + (% class="current" %)$syntaxTitle
316 +#end
633 633  )))
634 -|Nested quotes|(((
635 -<blockquote><p>john said this</p>
636 - <blockquote><p>marie answered that</p></blockquote>
637 -</blockquote>
638 -I said ok
639 -)))|((({{{
640 -> john said this
641 ->> marie answered that
642 -I said ok
643 -}}})))|(((
644 -> john said this
645 ->> marie answered that
646 -I said ok
647 -)))
318 +== $syntaxTitle: $services.rendering.escape($sectionName, 'xwiki/2.1') ==
648 648  
649 -= Groups =
650 -
651 -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.
652 -
653 -(% style="width:100%" %)
654 -|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
655 -|{{info}}This feature doesn't exist in XWiki syntax 1.0. You'd have to use pure HTML to achieve the result.{{/info}}|((({{{
656 -|=Header 1|=Header 2|=Header 3
657 -|Cell One|(((
658 -= Embedded document
659 -
660 -Some embedded paragraph.
661 -
662 -* list item one
663 -* list item two
664 - ** sub-item 1
665 - ** sub-item 2
666 -))) | Cell Three
667 -
668 -Next paragraph in the top-level document
669 -}}})))|(((
670 -|=Header 1|=Header 2|=Header 3
671 -|Cell One|(((
672 -{{html}}<h1 id="HEmbeddeddocument"><span>Embedded document</span></h1>{{/html}}
673 -
674 -Some embedded paragraph.
675 -
676 -* list item one
677 -* list item two
678 - ** sub-item 1
679 - ** sub-item 2
680 -))) | Cell Three
681 -
682 -Next paragraph in the top-level document
683 -)))
684 -
685 -= Escapes =
686 -
687 -(% style="width:100%" %)
688 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result XWiki Syntax 1.0|=Result XWiki Syntax 2.0
689 -|Escape a character|{{{This is not a \[link\]}}}|(((
690 -{{{This is not a ~[~[link~]~]}}}
691 -{{info}}To enter a ~~ character use a double escape: ~~~~{{/info}}
692 -)))|{{{This is not a [link]}}}|{{{This is not a [[link]]}}}
693 -
694 -= Macros =
695 -
696 -There are 2 kinds of macros in XWiki syntax 1.0:
697 -* Velocity macros (called using the ###macroname(param1 ... paramN)## syntax)
698 -* Radeox macros (called using the ##{macroname:param1=value1|...|paramN=valueN}## syntax)
699 -
700 -There are also 2 kinds of macros in XWiki Syntax 2.0:
701 -* Velocity macros (called using the ###macroname(param1 ... paramN)## syntax inside the Velocity Macro)
702 -* XWiki macros (called using the ##{{{{{macroname param1="value1" ... paramN="valueN"}}}}}## syntax)
703 -
704 -{{info}}The Radeox macros cannot be used in XWiki Syntax 2.0. Thus they have been rewritten as XWiki macros.{{/info}}
705 -
706 -{{info}}For the full list of available macros check the [[Macro Reference page>>http://code.xwiki.org/xwiki/bin/view/Macros/]].{{/info}}
707 -
708 -(% style="width:100%" %)
709 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
710 -|Velocity Macro|((({{{#info("Some text")}}})))|((({{{
711 -{{velocity}}{{html}}
712 -#info("some text")
713 -{{/html}}{{/velocity}}}}}
714 -{{info}}We're using the HTML macro in the example since the ###info## macro returns HTML content.{{/info}}
715 -
716 -{{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}}
717 -)))
718 -|Radeox Macro/XWiki Macros|((({{{
719 -{code:java}
720 -java content
721 -{code}
722 -}}})))|((({{{
723 -{{code language="java"}}
724 -java content
725 -{{/code}}
726 -}}})))
727 -
728 -= HTML =
729 -
730 -{{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}}
731 -
732 -(% style="width:100%" %)
733 -|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result
734 -|<b>bold</b>|{{{{{html}}<b>bold</b>{{/html}}}}}|{{html}}<b>bold</b>{{/html}}
735 -
736 -{{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}}
737 -
738 -= Velocity/Groovy Scripts =
739 -
740 -{{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}}
741 -
742 -(% style="width:100%" %)
743 -|=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0
744 -|Velocity script|((({{{
745 -#set ($var = "whatever")
746 -}}})))|((({{{
747 -{{velocity}}
748 -#set ($var = "whatever")
320 +#verticalNavigation($syntaxMenu {'translationPrefix' : 'syntax.', 'crtItemId' : "$!crtItemId", 'cssClass' : 'syntax-menu'})
321 +##-----------------------------------------
322 +## syntax-page display
323 +##-----------------------------------------
324 + #set ($subHeading = '===')
325 + (% id="syntax-page-content" %)(((
326 + #if(!$crtSection && !$crtCategory)
327 + #syntax_displayCategories($syntaxMenu 'syntax.')
328 + #elseif (!$crtSection)
329 + #syntax_displayCategory($crtCategory.children 'syntax.' '==')
330 + #else
331 + #syntax_displaySection($crtSection 'syntax.' false)
332 + #end
333 + ))) ## syntax-page-content
749 749  {{/velocity}}
750 -}}})))
751 -|Groovy script|((({{{
752 -<%
753 -def var = "whatever"
754 -%>
755 -}}})))|((({{{
756 -{{groovy}}
757 -def var = "whatever"
758 -{{/groovy}}
759 -}}})))
760 -
761 -= Parameters =
762 -
763 -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.
764 -
765 -(% style="width:100%" %)
766 -|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Generated XHTML
767 -|((({{{
768 -<h1 class="myClass" style="myStyle" id="myId">heading</h1>
769 -}}})))|((({{{
770 -(% class="myClass" style="myStyle" id="myId" %)
771 -= heading =
772 -}}})))|((({{{
773 -<h1 class="myClass" style="myStyle" id="myId">heading</h1>
774 -}}})))
775 -
776 -{{id name="syntaxes"/}}
777 -= Other syntaxes =
778 -
779 -The following other syntaxes are implemented in XWiki Enterprise 1.6 and later:
780 -* [[JSPWiki>>http://www.jspwiki.org/wiki/TextFormattingRules]]
781 -* [[MediaWiki>>http://en.wikipedia.org/wiki/Help:Editing]]
782 -* [[Confluence>>http://confluence.atlassian.com/display/CONF20/Confluence+Notation+Guide+Overview]]
783 -* [[TWiki>>http://twiki.org/cgi-bin/view/TWiki/WikiSyntax]]
784 -* [[Creole 1.0>>http://www.wikicreole.org/wiki/Creole1.0]]
785 -* [[XHTML 1.0>>http://www.w3.org/TR/xhtml1/]]
786 -
787 -{{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}}
Icon img.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Admin
Size
... ... @@ -1,1 +1,0 @@
1 -959 bytes
Content Icon
Icon XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,14 @@
1 +/* Administration application custom JavaScript */
2 +
3 +document.observe('xwiki:dom:loaded', function() {
4 + if($('goto-select')) {
5 + Event.observe($('goto-select'), 'change', function (event) {
6 + var select = event.element();
7 + var i = select.selectedIndex;
8 + if (window.location != select.options[i].value) {
9 + window.location = select.options[i].value;
10 + }
11 + });
12 + $('goto-select').next().hide();
13 + }
14 +});
Name
... ... @@ -1,0 +1,1 @@
1 +Syntax Guide javascript
Parse content
... ... @@ -1,0 +1,1 @@
1 +No
Use this extension
... ... @@ -1,0 +1,1 @@
1 +onDemand
Icon XWiki.StyleSheetExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,46 @@
1 +#document-title {
2 + margin-bottom: 1em;
3 +}
4 +#change-context {
5 + float: right;
6 + padding-top: 0.5em;
7 +}
8 +#goto-select optgroup {
9 + margin: 0.5ex;
10 +}
11 +
12 +#syntax-page-content {
13 + margin-left: 15em;
14 +}
15 +#syntax-page-content table {
16 + width: 99%;
17 +}
18 +#syntax-page-content>h3 {
19 + display: none;
20 +}
21 +#syntax-page-content>h3.sectionheader {
22 + display: block;
23 +}
24 +
25 +/*******************************************************/
26 +
27 +.syntax-menu .generalIcon {
28 + background-image: url("$xwiki.getSkinFile('icons/silk/page_white_code.gif')");
29 +}
30 +
31 +.syntax-menu .editingIcon {
32 + background-image: url("$xwiki.getSkinFile('icons/silk/page_white_edit.gif')");
33 +}
34 +
35 +.syntax-menu .advancedIcon {
36 + background-image: url("$xwiki.getSkinFile('icons/silk/wand.gif')");
37 +}
38 +
39 +.syntax-menu .programmingIcon {
40 + background-image: url("$xwiki.getSkinFile('icons/silk/page_white_gear.gif')");
41 +}
42 +
43 +/* Firefox panics when it has an overflowing table but the content is pre-formatted. */
44 +tbody>tr>td>tt {
45 + white-space: normal !important;
46 +}
Name
... ... @@ -1,0 +1,1 @@
1 +Syntax Guide Stylesheet
Parse content
... ... @@ -1,0 +1,1 @@
1 +Yes
Use this extension
... ... @@ -1,0 +1,1 @@
1 +onDemand