Changes for page InfoboxStyles

Last modified by Mads Pedersen on 2026/07/28 06:53

From version 5.1
edited by Mads Pedersen
on 2026/01/20 14:32
Change comment: There is no comment for this version
To version 8.5
edited by Mads Pedersen
on 2026/01/20 14:46
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,0 +1,3 @@
1 +{{wikibox/}}
2 +
3 +
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,21 +1,37 @@
1 1  {{html clean="false"}}
2 -<div class="xwiki-infobox">
3 - <table>
4 - <caption>$escapetool.xml($!parameters.title)</caption>
5 - #if("$!parameters.image" != "")
2 +<div style="float:right; width:280px; margin:0 0 1em 1em; border:1px solid #aaa; background:#f8f9fa; font-size:0.9em; font-family: sans-serif; line-height: 1.4;">
3 + <table style="width:100%; border-collapse:collapse;">
4 + #if($xcontext.macro.params.title && "$!xcontext.macro.params.title" != "")
5 + <caption style="background:#e5e5e5; font-weight:bold; padding:8px; border:1px solid #aaa; border-bottom:none; color: #333;">
6 + $xcontext.macro.params.title
7 + </caption>
8 + #end
9 +
10 + ## Only show this row if an image URL is provided
11 + #if($xcontext.macro.params.image && "$!xcontext.macro.params.image" != "")
6 6   <tr>
7 - <td colspan="2" class="xwiki-infobox-image">
8 - <img src="$escapetool.xml($!parameters.image)" alt="" />
9 - #if("$!parameters.imageCaption" != "")
10 - <div class="xwiki-infobox-image-caption">$escapetool.xml($!parameters.imageCaption)</div>
13 + <td colspan="2" style="text-align:center; padding:4px;">
14 + <img src="$xcontext.macro.params.image" style="max-width:100%; height:auto; display:block; margin: 0 auto;">
15 + #if($xcontext.macro.params.caption)
16 + <div style="font-size:0.85em; color:#555; padding: 4px 0;">$xcontext.macro.params.caption</div>
11 11   #end
12 12   </td>
13 13   </tr>
14 14   #end
15 15  
16 - <!-- Rows are provided by the user in the macro body -->
17 - $!content
22 + #set($content = $xcontext.macro.params.data)
23 + #if($content && "$!content" != "")
24 + ## Split content by newlines and handle each line
25 + #foreach($line in $content.split("\r?\n"))
26 + #if($line.contains("=") && "$!line.trim()" != "")
27 + #set($parts = $line.split("=", 2))
28 + <tr>
29 + <th style="border-top:1px solid #aaa; padding:6px; text-align:left; background:#f2f2f2; width:35%; vertical-align: top;">$parts[0].trim()</th>
30 + <td style="border-top:1px solid #aaa; padding:6px; vertical-align: top;">$parts[1].trim()</td>
31 + </tr>
32 + #end
33 + #end
34 + #end
18 18   </table>
19 19  </div>
20 20  {{/html}}
21 -
Macro content type
... ... @@ -1,1 +1,1 @@
1 -Wiki
1 +Velocity
Macro id
... ... @@ -1,0 +1,1 @@
1 +wikibox
Macro visibility
... ... @@ -1,1 +1,1 @@
1 -Global
1 +Current Wiki
XWiki.WikiMacroParameterClass[0]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The header text of the box.
Parameter name
... ... @@ -1,0 +1,1 @@
1 +title
XWiki.WikiMacroParameterClass[1]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +URL or attachment name for the image.
Parameter name
... ... @@ -1,0 +1,1 @@
1 +image
XWiki.WikiMacroParameterClass[2]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Text under the image.
Parameter name
... ... @@ -1,0 +1,1 @@
1 +caption
XWiki.WikiMacroParameterClass[3]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The label=value pairs
Parameter name
... ... @@ -1,0 +1,1 @@
1 +data