Cambios para el documento Guía de Sintaxis XWiki

Última modificación por Administrator el 2024/06/06 11:45

Desde la versión 3.1
editado por Administrator
el 2024/06/06 11:45
Cambiar el comentario: Install extension [org.xwiki.platform:xwiki-platform-help-ui/15.10.10]
Hasta la versión 2.1
editado por Administrator
el 2024/06/05 19:09
Cambiar el comentario: Migrated property [contentType] from class [XWiki.StyleSheetExtension]

Resumen

Detalles

Propiedades de página
Contenido
... ... @@ -1,30 +1,8 @@
1 1  {{velocity output="false"}}
2 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
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'))
28 28  
29 29  #if ($request.xaction == 'switchContext')
30 30   $response.sendRedirect($request.target)
... ... @@ -33,17 +33,16 @@
33 33  
34 34  #set ($crtCategoryId = "$!{request.category}")
35 35  #if ($crtCategoryId != '')
36 - #set ($crtCategoryId = $numbertool.toNumber($crtCategoryId).intValue())
14 + #set ($crtCategoryId = $mathtool.toInteger($crtCategoryId))
37 37  #end
38 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
17 +#set ($crtSyntaxVer = $mathtool.toDouble($request.syntax))
18 +#if ($crtSyntaxVer && $SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer))
19 + #set ($crtSyntaxVer = $mathtool.toDouble($crtSyntaxVer))
20 +
21 +#else
22 + #set ($crtSyntaxVer = 2.1) ## Default to Syntax 2.1
45 45  #end
46 -#set($crtSyntaxPos = $SUPPORTED_SYNTAX_ORDER.indexOf($crtSyntaxVer))
47 47  
48 48  #set ($extraParamList = [])
49 49  #if ($request.language)
... ... @@ -75,7 +75,7 @@
75 75   #set($obj = $sectionDoc.getObject("XWiki.XWikiSyntaxClass"))
76 76  
77 77   ## detect if we entered a new category
78 - #if($catCount < $obj.getProperty("category").value)
55 + #if($catCount < $obj.getProperty("category").value))
79 79   ## Put previous category into map (if existing), and reset children map
80 80   #if($catId)
81 81   #set($cat = { 'id' : $catId, 'name' : $catName, 'children' : $catChildren })
... ... @@ -112,7 +112,7 @@
112 112   #end
113 113  
114 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})
92 + #set($child = {'id' : $sectionDoc.getName().substring(11), 'minSyntax' : $obj.getProperty("minSyntaxVersion").value, 'maxSyntax' : $obj.getProperty("maxSyntaxVersion").value, 'name' : $sectionTitle})
116 116   $catChildren.add($child)
117 117   #end
118 118  #end
... ... @@ -127,11 +127,10 @@
127 127  #foreach ($category in $syntaxMenu)
128 128   #set ($sectionsToRemove = [])
129 129   #foreach ($section on $category.children)
130 - #set($minSyntaxPos = $SUPPORTED_SYNTAX_ORDER.indexOf($section.minSyntax))
131 - #if ($minSyntaxPos > $crtSyntaxPos)
107 + #if ($section.minSyntax > $crtSyntaxVer)
132 132   #set ($discard = $sectionsToRemove.add($section))
133 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)
110 + #set ($crtSectionId = '') ## clear section if it doesn't exist (can happen when switching from 2.0 to 2.1 syntax)
135 135   #end
136 136   #end
137 137   #end
... ... @@ -159,9 +159,9 @@
159 159  ##
160 160  #foreach ($category in $syntaxMenu)
161 161   ## "Standard" URLs and icons for categories
162 - #set ($category.url = "?syntax=$escapetool.url(${crtSyntaxVer})&category=${mathtool.sub($foreach.count, 1)}${extraParams}")
138 + #set ($category.url = "?syntax=$escapetool.url(${crtSyntaxVer})&category=${mathtool.sub($velocityCount, 1)}${extraParams}")
163 163   #set ($category.cssClass = "${category.id}Icon")
164 - #if ("$!{crtCategoryId}" != '' && $foreach.count == $mathtool.add($crtCategoryId, 1))
140 + #if ("$!{crtCategoryId}" != '' && $velocityCount == $mathtool.add($crtCategoryId, 1))
165 165   #set ($crtCategory = $category)
166 166   #end
167 167   ##
... ... @@ -196,24 +196,15 @@
196 196   *#
197 197  #macro(syntax_displayCategory $sections $translationPrefix $heading)
198 198   #foreach ($section in $sections)
199 - #syntax_displaySection($section $translationPrefix $heading)
200 - #end
201 -#end
202 -
203 -#macro(syntax_displaySection $section $translationPrefix $heading)
204 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)
176 + #if ($crtSyntaxVer > $section.maxSyntax)
209 209   #set ($displayVersion = $section.maxSyntax)
210 210   #end
211 - #if($heading)
212 212   (% class="sectionheader" %)
213 213   $heading $section.name $heading
214 214  
215 - #end
216 216   {{include reference="XWiki.XWikiSyntax${section.id}" section="H${displayVersion}${section.id}"/}}
183 + #end
217 217  #end
218 218  
219 219  
... ... @@ -258,7 +258,7 @@
258 258   #set ($crtSelection = "$extraParams")
259 259   #end
260 260  {{html}}
261 - <form id="change-context" class="xformInline" action="$doc.getURL()">
228 + <form id="change-context" class="xformInline" action="">
262 262   <div>
263 263   <input type="hidden" name="xaction" value="switchContext" />
264 264   #if ($request.language)
... ... @@ -269,10 +269,12 @@
269 269   #end
270 270   <select id="goto-select" name="target" title="$escapetool.xml($services.localization.render("help.changesyntax"))">
271 271   <optgroup label="$services.localization.render('help.choose_syntax')">
272 - #foreach($syntaxId in $SUPPORTED_SYNTAX_ORDER)
273 - #set ($query = "syntax=${escapetool.url($syntaxId)}&${crtSelection}")
274 - <option value="$escapetool.xml($doc.getURL('view', $query))"#if($crtSyntaxVer == $syntaxId) selected="selected"#end>$escapetool.html($SUPPORTED_SYNTAXES.get($syntaxId))</option>
275 - #end
239 + #set ($query = "syntax=1.0&${crtSelection}")
240 + <option value="$doc.getURL('view', $query)" #if($crtSyntaxVer==1.0)selected="selected"#end>$SUPPORTED_SYNTAXES.get(1.0)</option>
241 + #set ($query = "syntax=2.0&${crtSelection}")
242 + <option value="$doc.getURL('view', $query)" #if($crtSyntaxVer==2.0)selected="selected"#end>$SUPPORTED_SYNTAXES.get(2.0)</option>
243 + #set ($query = "syntax=2.1&${crtSelection}")
244 + <option value="$doc.getURL('view', $query)" #if($crtSyntaxVer==2.1)selected="selected"#end>$SUPPORTED_SYNTAXES.get(2.1)</option>
276 276   </optgroup>
277 277   </select>
278 278   <span class="buttonwrapper"><input type="submit" value="$escapetool.xml($services.localization.render('admin.switchContext'))" class="button" /></span>
... ... @@ -300,7 +300,7 @@
300 300  #syntaxSwitch()
301 301  (((
302 302  #set ($query = "syntax=$escapetool.url(${crtSyntaxVer})${extraParams}")
303 -#if ($crtCategory){{html}}<a href="${doc.getURL('view', ${query})}">$syntaxTitle</a>{{/html}}#{else}(% class="current" %)$syntaxTitle#{end}#if ($crtCategory) » #if ($crtSection){{html}}<a href="${crtCategory.url}">${crtCategory.name}</a>{{/html}}#{else}(% class="current" %)${crtCategory.name}#{end}#if ($crtSection) » (% class="current" %)${crtSection.name}#end#end
272 +#if ($crtCategory){{html}}<a href="${doc.getURL('view', ${query})}">$syntaxTitle</a>{{/html}}#{else}(% class="current" %)$syntaxTitle#{end}#if ($crtCategory) (% class="separator" %)» #if ($crtSection){{html}}<a href="${crtCategory.url}">${crtCategory.name}</a>{{/html}}#{else}(% class="current" %)${crtCategory.name}#{end}#if ($crtSection) (% class="separator" %)» (% class="current" %)${crtSection.name}#end#end
304 304  )))
305 305  == $syntaxTitle: $sectionName ==
306 306  
... ... @@ -308,14 +308,19 @@
308 308  ##-----------------------------------------
309 309  ## syntax-page display
310 310  ##-----------------------------------------
311 - #set ($subHeading = '===')
312 312   (% id="syntax-page-content" %)(((
313 313   #if(!$crtSection && !$crtCategory)
314 314   #syntax_displayCategories($syntaxMenu 'syntax.')
315 315   #elseif (!$crtSection)
284 + #set ($subHeading = '===')
316 316   #syntax_displayCategory($crtCategory.children 'syntax.' '==')
317 317   #else
318 - #syntax_displaySection($crtSection 'syntax.' false)
287 + #set ($displayVersion = $crtSyntaxVer)
288 + #if ($crtSyntaxVer > $crtSection.maxSyntax)
289 + #set ($displayVersion = $crtSection.maxSyntax)
290 + #end
291 + #set ($subHeading = '==')
292 + {{include reference="XWiki.XWikiSyntax${crtSection.id}" section="H${displayVersion}${crtSection.id}"/}}
319 319   #end
320 320   ))) ## syntax-page-content
321 321  {{/velocity}}