Changes for page Version Macro
Last modified by Michael Hamann on 2024/05/15
From version 31.2
edited by Vincent Massol
on 2020/09/04
on 2020/09/04
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,6 +1,6 @@ 1 1 Note: This macro works only standalone (and not inline) voluntarily. This is to allow displaying the versions in the gutter for example, which wouldn't be possible if used inline. 2 2 3 -= Example 1 = 3 += Example 1: Inline with "since" = 4 4 5 5 {{code}} 6 6 {{version since='11.10.5, 12.5, 12.7RC1'}} ... ... @@ -14,11 +14,14 @@ 14 14 New feature... 15 15 {{/version}} 16 16 17 -= Example 2 =17 += Example 2: Standalone with "before" = 18 18 19 19 {{code}} 20 20 {{version before='11.10.5, 12.5'}} 21 -New feature... 21 +Paragraph1 22 + 23 +Paragraph2 24 + 22 22 {{/version}} 23 23 {{/code}} 24 24 ... ... @@ -25,5 +25,22 @@ 25 25 Results in: 26 26 27 27 {{version before='11.10.5, 12.5'}} 28 -New feature... 31 +Paragraph1 32 + 33 +Paragraph2 29 29 {{/version}} 35 + 36 += Example 3: Inline in list items = 37 + 38 +{{code}} 39 +* {{version since='11.10.5'}}List item1{{/version}} 40 +* {{version since='12.5'}}List item2{{/version}} 41 +* {{version since='12.7RC1'}}List item3{{/version}} 42 +{{/code}} 43 + 44 +Results in: 45 + 46 +* {{version since='11.10.5'}}List item1{{/version}} 47 +* {{version since='12.5'}}List item2{{/version}} 48 +* {{version since='12.7RC1'}}List item3{{/version}} 49 +
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -1,4 +1,4 @@ 1 -[data-xwikiorg-versions- since], [data-xwikiorg-versions-before] {1 +[data-xwikiorg-versions-range] { 2 2 border-left: 2px solid lightgray; 3 3 padding-left: 6px; 4 4 }
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -21,9 +21,15 @@ 21 21 #end 22 22 #set ($dataSuffix = 'before') 23 23 #end 24 +#set ($xdom = $services.rendering.parse($xcontext.macro.content, $wikimacro.context.getSyntax().toIdString())) 25 +#if ($xdom.children.size() > 1) 26 + #set ($severalBlocksAttribute = ' data-xwikiorg-versions-range="$xdom.children.size()"') 27 +#else 28 + #set ($severalBlocksAttribute = '') 29 +#end 24 24 #if ($wikimacro.context.isInline()) 25 25 {{html clean='false' wiki='true'}} 26 -<span data-xwikiorg-versions-${dataSuffix}="$stringtool.join($plainVersions, ', ')"> 32 +<span data-xwikiorg-versions-${dataSuffix}="$stringtool.join($plainVersions, ', ')"${severalBlocksAttribute}> 27 27 <span class='badge' title="$stringtool.capitalize($dataSuffix) $stringtool.join($plainVersions, ', ')">$stringtool.join($versions, ', ')</span> 28 28 {{wikimacrocontent/}} 29 29 </span> ... ... @@ -30,7 +30,7 @@ 30 30 </span> 31 31 {{/html}} 32 32 #else 33 -(% data-xwikiorg-versions-${dataSuffix}="$stringtool.join($plainVersions, ', ')" %)((( 39 +(% data-xwikiorg-versions-${dataSuffix}="$stringtool.join($plainVersions, ', ')"${severalBlocksAttribute} %)((( 34 34 (% class='badge' title="$stringtool.capitalize($dataSuffix) $stringtool.join($plainVersions, ', ')" %)$stringtool.join($versions, ', ')(%%) {{wikimacrocontent/}} 35 35 ))) 36 36 #end