Changes for page XWiki Syntax Guide

Last modified by Ludovic Dubost on 2020/07/30 11:21

From version 4.1
edited by Ludovic Dubost
on 2014/11/18 12:31
Change comment: Install extension [org.xwiki.platform:xwiki-platform-help-ui-6.3]
To version 3.1
edited by Thomas Mortagne
on 2014/09/29 12:41
Change comment: Install extension [org.xwiki.platform:xwiki-platform-help-ui-6.2]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.ludovic
1 +xwiki:XWiki.ThomasMortagne
Content
... ... @@ -4,18 +4,6 @@
4 4  #set($void = $SUPPORTED_SYNTAXES.put(2.0, 'XWiki Syntax 2.0'))
5 5  #set($void = $SUPPORTED_SYNTAXES.put(2.1, 'XWiki Syntax 2.1'))
6 6  
7 -## We need a way to have a mapping between a string and a number, and we cannot use $mathtool.toDouble() because
8 -## it is locale dependent (see: http://jira.xwiki.org/browse/XWIKI-11343).
9 -## TODO: fix $mathtool or create a script service that handles this english-locale string<->number conversion,
10 -## because this fix is a bit hacky/spaghetti.
11 -## A better fix would be to refactor this application, because the syntax number SHOULD NOT BE USED because a syntax
12 -## is not supposed to be a number (imagine that we switch to 'Markdown', it is impossible to compare).
13 -## Instead, a syntax object should have a list of categories that the syntax supports.
14 -#set($NUMBERS_CONVERSION = {})
15 -#set($void = $NUMBERS_CONVERSION.put('1.0', 1.0))
16 -#set($void = $NUMBERS_CONVERSION.put('2.0', 2.0))
17 -#set($void = $NUMBERS_CONVERSION.put('2.1', 2.1))
18 -
19 19  #if ($request.xaction == 'switchContext')
20 20   $response.sendRedirect($request.target)
21 21   #stop
... ... @@ -26,8 +26,11 @@
26 26   #set ($crtCategoryId = $mathtool.toInteger($crtCategoryId))
27 27  #end
28 28  #set ($crtSectionId = "$!{request.section}")
29 -#set ($crtSyntaxVer = $NUMBERS_CONVERSION.get($request.syntax))
30 -#if ("$!crtSyntaxVer" == '' || !$SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer))
17 +#set ($crtSyntaxVer = $mathtool.toDouble($request.syntax))
18 +#if ($crtSyntaxVer && $SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer))
19 + #set ($crtSyntaxVer = $mathtool.toDouble($crtSyntaxVer))
20 +
21 +#else
31 31   #set ($crtSyntaxVer = 2.1) ## Default to Syntax 2.1
32 32  #end
33 33  
... ... @@ -113,7 +113,6 @@
113 113  #foreach ($category in $syntaxMenu)
114 114   #set ($sectionsToRemove = [])
115 115   #foreach ($section on $category.children)
116 - ## TODO: This should be refactored (see before): a syntax is not supposed to be a number
117 117   #if ($section.minSyntax > $crtSyntaxVer)
118 118   #set ($discard = $sectionsToRemove.add($section))
119 119   #if ($section.id == $crtSectionId)
... ... @@ -183,7 +183,6 @@
183 183  #macro(syntax_displayCategory $sections $translationPrefix $heading)
184 184   #foreach ($section in $sections)
185 185   #set ($displayVersion = $crtSyntaxVer)
186 - ## TODO: This should be refactored (see before): a syntax is not supposed to be a number
187 187   #if ($crtSyntaxVer > $section.maxSyntax)
188 188   #set ($displayVersion = $section.maxSyntax)
189 189   #end