Changes for page InfoboxStyles

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

From version 8.26
edited by Mads Pedersen
on 2026/01/20 16:30
Change comment: There is no comment for this version
To version 8.28
edited by Mads Pedersen
on 2026/01/21 12:49
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,8 +1,14 @@
1 1  {{velocity}}
2 2  {{html clean="false"}}
3 3  
4 +#set($width = $xcontext.macro.params.width)
5 +#set($labelWidth = $xcontext.macro.params.labelWidth)
6 +
7 +## Default values if parameters are missing
8 +#if("$!width" == "") #set($width = "22") #end
9 +#if("$!labelWidth" == "") #set($labelWidth = "35%") #end
10 +
4 4  <style>
5 - /* Standard Wiki View */
6 6   .custom-infobox {
7 7   float: right;
8 8   margin: 0 0 1em 1em;
... ... @@ -14,7 +14,6 @@
14 14   box-shadow: 0 2px 4px rgba(0,0,0,0.1);
15 15   }
16 16  
17 - /* Export / Print View Fix */
18 18   @media print {
19 19   .custom-infobox {
20 20   float: none !important;
... ... @@ -25,8 +25,8 @@
25 25   }
26 26  </style>
27 27  
28 -<div style="float:right; width:$xcontext.macro.params.width\rem; margin:0 0 1em 1em; border:1px solid #aaa; background:#f8f9fa; font-size:0.9em; font-family: sans-serif; line-height: 1.5; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
29 - <table style="width:100%; border-collapse:collapse;">
33 +<div class="custom-infobox" style="width:${width}rem;">
34 + <table style="width:100%; border-collapse:collapse; table-layout: fixed;">
30 30   ## Header
31 31   #if($xcontext.macro.params.title && "$!xcontext.macro.params.title" != "")
32 32   <caption style="background:#eeeeee; font-weight:bold; padding:10px; border:1px solid #aaa; border-bottom:none; color: #000;">
... ... @@ -46,7 +46,7 @@
46 46   </tr>
47 47   #end
48 48  
49 - ## Parse the Macro Content (The big box)
54 + ## Parse the Macro Content
50 50   #set($macroContent = $xcontext.macro.content)
51 51   #if($macroContent && "$!macroContent.trim()" != "")
52 52   #foreach($line in $macroContent.split("\n"))
... ... @@ -54,10 +54,10 @@
54 54   #if($trimmedLine.contains("=") && $trimmedLine.length() > 2)
55 55   #set($parts = $trimmedLine.split("=", 2))
56 56   <tr>
57 - <th style="border-top:1px solid #ddd; padding:8px; text-align:left; background:#f9f9f9; width:35%; vertical-align: top; font-weight: 600;">
62 + <th style="border-top:1px solid #ddd; padding:8px; text-align:left; background:#f9f9f9; width:${labelWidth}; vertical-align: top; font-weight: 600; word-break: break-word;">
58 58   $parts[0].trim()
59 59   </th>
60 - <td style="border-top:1px solid #ddd; padding:8px; vertical-align: top; background: #fff;">
65 + <td style="border-top:1px solid #ddd; padding:8px; vertical-align: top; background: #fff; word-break: break-word;">
61 61   $parts[1].trim()
62 62   </td>
63 63   </tr>
XWiki.WikiMacroParameterClass[3]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -20
XWiki.WikiMacroParameterClass[4]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Width of the left column, defaults to 35%
Parameter name
... ... @@ -1,0 +1,1 @@
1 +labelWidth