Changes for page XWiki Syntax Guide
Last modified by Ludovic Dubost on 2020/07/30 11:21
From version 3.1
edited by Thomas Mortagne
on 2014/09/29 12:41
on 2014/09/29 12:41
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-help-ui-6.2]
To version 5.1
edited by Ludovic Dubost
on 2015/09/01 11:47
on 2015/09/01 11:47
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-help-ui-7.1]
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. ThomasMortagne1 +xwiki:XWiki.ludovic - Content
-
... ... @@ -4,6 +4,18 @@ 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 + 7 7 #if ($request.xaction == 'switchContext') 8 8 $response.sendRedirect($request.target) 9 9 #stop ... ... @@ -14,11 +14,8 @@ 14 14 #set ($crtCategoryId = $mathtool.toInteger($crtCategoryId)) 15 15 #end 16 16 #set ($crtSectionId = "$!{request.section}") 17 -#set ($crtSyntaxVer = $mathtool.toDouble($request.syntax)) 18 -#if ($crtSyntaxVer && $SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer)) 19 - #set ($crtSyntaxVer = $mathtool.toDouble($crtSyntaxVer)) 20 - 21 -#else 29 +#set ($crtSyntaxVer = $NUMBERS_CONVERSION.get($request.syntax)) 30 +#if ("$!crtSyntaxVer" == '' || !$SUPPORTED_SYNTAXES.containsKey($crtSyntaxVer)) 22 22 #set ($crtSyntaxVer = 2.1) ## Default to Syntax 2.1 23 23 #end 24 24 ... ... @@ -104,6 +104,7 @@ 104 104 #foreach ($category in $syntaxMenu) 105 105 #set ($sectionsToRemove = []) 106 106 #foreach ($section on $category.children) 116 + ## TODO: This should be refactored (see before): a syntax is not supposed to be a number 107 107 #if ($section.minSyntax > $crtSyntaxVer) 108 108 #set ($discard = $sectionsToRemove.add($section)) 109 109 #if ($section.id == $crtSectionId) ... ... @@ -173,6 +173,7 @@ 173 173 #macro(syntax_displayCategory $sections $translationPrefix $heading) 174 174 #foreach ($section in $sections) 175 175 #set ($displayVersion = $crtSyntaxVer) 186 + ## TODO: This should be refactored (see before): a syntax is not supposed to be a number 176 176 #if ($crtSyntaxVer > $section.maxSyntax) 177 177 #set ($displayVersion = $section.maxSyntax) 178 178 #end ... ... @@ -225,7 +225,7 @@ 225 225 #set ($crtSelection = "$extraParams") 226 226 #end 227 227 {{html}} 228 - <form id="change-context" class="xformInline" action=""> 239 + <form id="change-context" class="xformInline" action="$doc.getURL()"> 229 229 <div> 230 230 <input type="hidden" name="xaction" value="switchContext" /> 231 231 #if ($request.language)