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.8
edited by Mads Pedersen
on 2026/01/20 14:53
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,65 +1,32 @@
1 1  {{velocity}}
2 2  {{html clean="false"}}
3 -
4 -<style>
5 - /* Standard Wiki View */
6 - .custom-infobox {
7 - float: right;
8 - margin: 0 0 1em 1em;
9 - border: 1px solid #aaa;
10 - background: #f8f9fa;
11 - font-size: 0.9em;
12 - font-family: sans-serif;
13 - line-height: 1.5;
14 - box-shadow: 0 2px 4px rgba(0,0,0,0.1);
15 - }
16 -
17 - /* Export / Print View Fix */
18 - @media print {
19 - .custom-infobox {
20 - float: none !important;
21 - width: 100% !important;
22 - margin: 1em 0 !important;
23 - box-shadow: none !important;
24 - }
25 - }
26 -</style>
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);">
3 +<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;">
29 29   <table style="width:100%; border-collapse:collapse;">
30 - ## Header
31 31   #if($xcontext.macro.params.title && "$!xcontext.macro.params.title" != "")
32 - <caption style="background:#eeeeee; font-weight:bold; padding:10px; border:1px solid #aaa; border-bottom:none; color: #000;">
6 + <caption style="background:#e5e5e5; font-weight:bold; padding:8px; border:1px solid #aaa; border-bottom:none; color: #333;">
33 33   $xcontext.macro.params.title
34 34   </caption>
35 35   #end
36 36  
37 - ## Image
38 38   #if($xcontext.macro.params.image && "$!xcontext.macro.params.image" != "")
39 39   <tr>
40 - <td colspan="2" style="text-align:center; padding:8px; background: #fff;">
13 + <td colspan="2" style="text-align:center; padding:4px;">
41 41   <img src="$xcontext.macro.params.image" style="max-width:100%; height:auto; display:block; margin: 0 auto;">
42 42   #if($xcontext.macro.params.caption && "$!xcontext.macro.params.caption" != "")
43 - <div style="font-size:0.9em; color:#666; padding-top: 6px; font-style: italic;">$xcontext.macro.params.caption</div>
16 + <div style="font-size:0.85em; color:#555; padding: 4px 0;">$xcontext.macro.params.caption</div>
44 44   #end
45 45   </td>
46 46   </tr>
47 47   #end
48 48  
49 - ## Parse the Macro Content (The big box)
50 - #set($macroContent = $xcontext.macro.content)
51 - #if($macroContent && "$!macroContent.trim()" != "")
52 - #foreach($line in $macroContent.split("\n"))
53 - #set($trimmedLine = $line.trim())
54 - #if($trimmedLine.contains("=") && $trimmedLine.length() > 2)
55 - #set($parts = $trimmedLine.split("=", 2))
22 + #set($content = $xcontext.macro.params.data)
23 + #if($content && "$!content" != "")
24 + #foreach($line in $content.split("\r?\n"))
25 + #if($line.contains("=") && "$!line.trim()" != "")
26 + #set($parts = $line.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;">
58 - $parts[0].trim()
59 - </th>
60 - <td style="border-top:1px solid #ddd; padding:8px; vertical-align: top; background: #fff;">
61 - $parts[1].trim()
62 - </td>
28 + <th style="border-top:1px solid #aaa; padding:6px; text-align:left; background:#f2f2f2; width:35%; vertical-align: top;">$parts[0].trim()</th>
29 + <td style="border-top:1px solid #aaa; padding:6px; vertical-align: top;">$parts[1].trim()</td>
63 63   </tr>
64 64   #end
65 65   #end
Content description (Not applicable for "No content" type)
... ... @@ -1,1 +1,0 @@
1 -Write lines into the infobox like "Label=Example text"
Macro content availability
... ... @@ -1,1 +1,1 @@
1 -Mandatory
1 +No content
XWiki.WikiMacroParameterClass[0]
Parameter order property
... ... @@ -1,1 +1,0 @@
1 -10
XWiki.WikiMacroParameterClass[1]
Parameter order property
... ... @@ -1,1 +1,0 @@
1 -11
XWiki.WikiMacroParameterClass[2]
Parameter order property
... ... @@ -1,1 +1,0 @@
1 -12
XWiki.WikiMacroParameterClass[3]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -20
Parameter description
... ... @@ -1,1 +1,1 @@
1 -The width of the box. Default 20
1 +Write lines into the infobox like "Label=Example text"
Parameter name
... ... @@ -1,1 +1,1 @@
1 -width
1 +data
Parameter order property
... ... @@ -1,0 +1,1 @@
1 +10
Parameter type
... ... @@ -1,0 +1,1 @@
1 +TextArea