https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AOverlay%2Fsandbox Module:Overlay/sandbox - Revision history 2025-06-01T01:15:02Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:Overlay/sandbox&diff=1150193789&oldid=prev Lemondoge at 20:24, 16 April 2023 2023-04-16T20:24:09Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 20:24, 16 April 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 132:</td> <td colspan="2" class="diff-lineno">Line 132:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local image = args['image'] or ''</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local image = args['image'] or ''</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local width = tonumber(args['width'] or <del style="font-weight: bold; text-decoration: none;">'</del>500<del style="font-weight: bold; text-decoration: none;">'</del>) or 500</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local width = tonumber(args['width'] or 500) or 500</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local height = tonumber(args['height'] or <del style="font-weight: bold; text-decoration: none;">'</del>500<del style="font-weight: bold; text-decoration: none;">'</del>) or 500</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local height = tonumber(args['height'] or 500) or 500</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local columns = tonumber(args['columns'] or <del style="font-weight: bold; text-decoration: none;">'</del>3<del style="font-weight: bold; text-decoration: none;">'</del>) or 3</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local columns = tonumber(args['columns'] or 3) or 3</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local grid = ((args['grid'] or ''):lower() == 'yes') and 'yes' or 'no'</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local grid = ((args['grid'] or ''):lower() == 'yes') and 'yes' or 'no'</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local legendbox = ((args['legendbox'] or ''):lower() == 'no') and 'no' or 'yes'</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local legendbox = ((args['legendbox'] or ''):lower() == 'no') and 'no' or 'yes'</div></td> </tr> </table> Lemondoge https://en.wikipedia.org/w/index.php?title=Module:Overlay/sandbox&diff=997692747&oldid=prev WOSlinker: remove moz and webkit as standard now well supported 2021-01-01T19:46:59Z <p>remove moz and webkit as standard now well supported</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:46, 1 January 2021</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 47:</td> <td colspan="2" class="diff-lineno">Line 47:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('padding', ((tonumber(n) or 0) &lt; 10) and '0px 4px' or '0px 2px')</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('padding', ((tonumber(n) or 0) &lt; 10) and '0px 4px' or '0px 2px')</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('vertical-align', 'middle')</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('vertical-align', 'middle')</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> :css('-moz-border-radius', '3px')</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> :css('-webkit-border-radius', '3px')</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('border-radius', '3px')</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('border-radius', '3px')</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('background-color', c)</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :css('background-color', c)</div></td> </tr> </table> WOSlinker https://en.wikipedia.org/w/index.php?title=Module:Overlay/sandbox&diff=856579166&oldid=prev Jonesey95: sync with live module 2018-08-26T06:26:58Z <p>sync with live module</p> <p><b>New page</b></p><div>-- this module implements [[Template:Overlay]]<br /> local p = {}<br /> <br /> local mArguments = require(&#039;Module:Arguments&#039;)<br /> <br /> -- used to cache the calculated font color to avoid repeat calculations<br /> local previous_backgroundcolor = &#039;&#039;<br /> local fontcolor = &#039;&#039;<br /> <br /> local function buildicon(n, form, lk, c, t)<br /> local res<br /> if form == &#039;text&#039; then<br /> return tostring(<br /> mw.html.create(&#039;span&#039;)<br /> :css(&#039;font-weight&#039;, &#039;bold&#039;)<br /> :css(&#039;color&#039;, c)<br /> :wikitext(n)<br /> )<br /> elseif form == &#039;color&#039; or form == &#039;colour&#039; then<br /> return tostring(<br /> mw.html.create(&#039;span&#039;)<br /> :css(&#039;background-color&#039;, c)<br /> :wikitext(&#039;&amp;#160;&amp;#160;&#039;)<br /> )<br /> else<br /> -- check if the color is difference from the previous color<br /> if c ~= previous_backgroundcolor then<br /> -- color changed, so look up the best font color<br /> local greatercontrast = require(&#039;Module:Color contrast&#039;)._greatercontrast<br /> fontcolor = greatercontrast{c, &#039;white&#039;, &#039;black&#039;, bias = 1.3}<br /> -- update the previous value for the next check<br /> previous_backgroundcolor = c<br /> end<br /> -- build the inner span for the icon<br /> local span = mw.html.create(&#039;span&#039;)<br /> :css(&#039;color&#039;, fontcolor)<br /> :css(&#039;font-size&#039;, &#039;88%&#039;)<br /> :css(&#039;font-weight&#039;, &#039;bold&#039;)<br /> :attr(&#039;title&#039;, t)<br /> :wikitext(n)<br /> -- build the outer div<br /> local div = mw.html.create(&#039;div&#039;)<br /> :css(&#039;display&#039;, &#039;inline-block&#039;)<br /> :css(&#039;width&#039;, &#039;auto&#039;)<br /> :css(&#039;height&#039;, &#039;auto&#039;)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> :css(&#039;padding&#039;, ((tonumber(n) or 0) &lt; 10) and &#039;0px 4px&#039; or &#039;0px 2px&#039;)<br /> :css(&#039;vertical-align&#039;, &#039;middle&#039;)<br /> :css(&#039;-moz-border-radius&#039;, &#039;3px&#039;)<br /> :css(&#039;-webkit-border-radius&#039;, &#039;3px&#039;)<br /> :css(&#039;border-radius&#039;, &#039;3px&#039;)<br /> :css(&#039;background-color&#039;, c)<br /> <br /> -- link the inner span if requested and insert in the div<br /> if lk ~= &#039;&#039; then<br /> div:wikitext(&#039;[[:&#039; .. lk .. &#039;|&#039; .. tostring(span) .. &#039;]]&#039;)<br /> else<br /> div:wikitext(tostring(span))<br /> end<br /> -- convert to a string<br /> return tostring(div)<br /> end<br /> end<br /> <br /> local function buildlegend(data, cols, border, caption)<br /> -- create the outer table to hold the columns<br /> local root = mw.html.create(&#039;table&#039;)<br /> :css(&#039;width&#039;, &#039;100%&#039;)<br /> :css(&#039;border&#039;, (border ~= &#039;no&#039;) and &#039;1px #ccc solid&#039; or &#039;&#039;)<br /> -- create the outer row which will contain the columns<br /> local outerrow = root:tag(&#039;tr&#039;)<br /> local percol = math.ceil((#data) / cols)<br /> local k = 0<br /> for j=1,cols do<br /> -- create the outer cell to hold this column<br /> local colcell = outerrow:tag(&#039;td&#039;)<br /> :css(&#039;width&#039;, (math.floor(10/cols)/10) .. &#039;%&#039;)<br /> :css(&#039;vertical-align&#039;, &#039;top&#039;)<br /> -- create the inner table to hold the entries in the column<br /> local coltable = colcell:tag(&#039;table&#039;)<br /> :css(&#039;width&#039;, &#039;100%&#039;)<br /> :css(&#039;font-size&#039;, &#039;85%&#039;)<br /> :css(&#039;line-height&#039;, &#039;95%&#039;)<br /> -- add the entries to the column<br /> for l = 1,percol do<br /> k = k + 1<br /> if k &lt;= #data then<br /> local rdata = data[k]<br /> local tr = coltable:tag(&#039;tr&#039;):css(&#039;vertical-align&#039;,&#039;top&#039;)<br /> tr:tag(&#039;td&#039;)<br /> :css(&#039;width&#039;, &#039;12px&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :css(&#039;padding-bottom&#039;, &#039;2px&#039;)<br /> :wikitext(rdata[1] or &#039;&#039;)<br /> tr:tag(&#039;td&#039;)<br /> :css(&#039;padding-bottom&#039;, &#039;2px&#039;)<br /> :wikitext(rdata[2] or &#039;&#039;)<br /> end<br /> end<br /> end<br /> return caption .. tostring(root)<br /> end<br /> <br /> local function buildlegenditem(im, lk, t)<br /> local res = {im, &#039;&#039;}<br /> if t ~= &#039;&#039; then<br /> if lk ~= &#039;&#039; then<br /> res[2] = &#039;[[:&#039; .. lk .. &#039;|&#039; .. t .. &#039;]]&#039;<br /> else<br /> res[2] = t<br /> end<br /> else<br /> res[2] = &#039;[[:&#039; .. lk .. &#039;|&#039; .. lk .. &#039;]]&#039;<br /> end<br /> return res <br /> end<br /> <br /> function p.icon(frame)<br /> local args = mArguments.getArgs(frame)<br /> return tostring(<br /> mw.html.create(&#039;div&#039;)<br /> :css(&#039;display&#039;, &#039;inline-block&#039;)<br /> :css(&#039;line-height&#039;, &#039;95%&#039;)<br /> :wikitext(buildicon(args[&#039;1&#039;] or &#039;&#039;, <br /> args[&#039;form&#039;] or &#039;icon&#039;,<br /> args[&#039;link&#039;] or &#039;&#039;, <br /> args[&#039;2&#039;] or &#039;red&#039;,<br /> args[&#039;tip&#039;] or &#039;&#039;))<br /> )<br /> end<br /> <br /> function p.main(frame)<br /> local args = mArguments.getArgs(frame)<br /> <br /> local image = args[&#039;image&#039;] or &#039;&#039;<br /> local width = tonumber(args[&#039;width&#039;] or &#039;500&#039;) or 500<br /> local height = tonumber(args[&#039;height&#039;] or &#039;500&#039;) or 500<br /> local columns = tonumber(args[&#039;columns&#039;] or &#039;3&#039;) or 3<br /> local grid = ((args[&#039;grid&#039;] or &#039;&#039;):lower() == &#039;yes&#039;) and &#039;yes&#039; or &#039;no&#039;<br /> local legendbox = ((args[&#039;legendbox&#039;] or &#039;&#039;):lower() == &#039;no&#039;) and &#039;no&#039; or &#039;yes&#039;<br /> local overlay = (image == &#039;&#039;) and &#039;no&#039; or ( ((args[&#039;overlay&#039;] or &#039;&#039;):lower() == &#039;no&#039;) and &#039;no&#039; or &#039;yes&#039; )<br /> local float = args[&#039;float&#039;] or &#039;center&#039;<br /> local border = ((args[&#039;border&#039;] or &#039;&#039;):lower() == &#039;no&#039;) and &#039;no&#039; or &#039;yes&#039;<br /> local padding = args[&#039;padding&#039;] or &#039;&#039;<br /> <br /> -- create the root table<br /> local root = mw.html.create(&#039;table&#039;)<br /> if float == &#039;center&#039; or float == &#039;centre&#039; then<br /> root:css(&#039;margin-left&#039;, &#039;auto&#039;)<br /> :css(&#039;margin-right&#039;, &#039;auto&#039;)<br /> elseif float == &#039;right&#039; then<br /> root:css(&#039;float&#039;, &#039;right&#039;)<br /> :css(&#039;clear&#039;, &#039;right&#039;)<br /> :css(&#039;margin-left&#039;, &#039;1em&#039;)<br /> elseif float == &#039;left&#039; then<br /> root:css(&#039;float&#039;, &#039;left&#039;)<br /> :css(&#039;clear&#039;, &#039;left&#039;)<br /> :css(&#039;margin-right&#039;, &#039;1em&#039;)<br /> else<br /> root:css(&#039;float&#039;, float)<br /> end<br /> if border == &#039;yes&#039; then<br /> root:css(&#039;border&#039;, &#039;1px #ccc solid&#039;)<br /> end<br /> <br /> -- create a list of all the overlay numbers<br /> local itemnums = {}<br /> for k, v in pairs( args ) do<br /> local i = tonumber(tostring(k):match( &#039;^%s*overlay([%d]+)%s*$&#039; ) or &#039;-1&#039;)<br /> if i &gt; -1 then<br /> table.insert(itemnums, i)<br /> else<br /> i = tonumber(tostring(k):match( &#039;^%s*overlay([%d]+)tip%s*$&#039; ) or &#039;-1&#039;)<br /> if i &gt; -1 then<br /> table.insert(itemnums, i)<br /> end<br /> end<br /> end<br /> -- sort to process in order<br /> table.sort( itemnums )<br /> <br /> -- remove duplicates<br /> for k = 2,#itemnums do<br /> if itemnums[k] == itemnums[k-1] then<br /> table.remove(itemnums, k)<br /> end<br /> end<br /> <br /> -- build the overlay markers and text<br /> itemdata = {}<br /> local colori = args[&#039;color&#039;] or args[&#039;colour&#039;] or &#039;red&#039;<br /> local formi = &#039;&#039; <br /> for k = 1,#itemnums do<br /> local i = itemnums[k]<br /> formi = args[&#039;overlay&#039; .. i .. &#039;form&#039;] or formi<br /> colori = args[&#039;overlay&#039; .. i .. &#039;color&#039;] or args[&#039;overlay&#039; .. i .. &#039;colour&#039;] or colori<br /> local linki = args[&#039;overlay&#039; .. i .. &#039;link&#039;] or &#039;&#039;<br /> local tipi = args[&#039;overlay&#039; .. i .. &#039;tip&#039;] or args[&#039;overlay&#039; .. i] or &#039;&#039;<br /> local overlayi = args[&#039;overlay&#039; .. i] or args[&#039;overlay&#039; .. i .. &#039;tip&#039;] or &#039;&#039;<br /> if (overlayi ~= &#039;&#039; or tipi ~= &#039;&#039;) then<br /> local imagei = buildicon(i, formi, linki, colori, tipi)<br /> itemdata[k] = buildlegenditem(imagei, args[&#039;overlay&#039; .. i .. &#039;link&#039;] or &#039;&#039;, overlayi)<br /> end<br /> end<br /> <br /> -- create the overlay image<br /> if image ~= &#039;&#039; then<br /> local cell = root:tag(&#039;tr&#039;):tag(&#039;td&#039;)<br /> cell:attr(&#039;align&#039;, &#039;center&#039;)<br /> if( padding ~= &#039;&#039; ) then<br /> cell:css(&#039;padding&#039;, padding)<br /> end<br /> if( columns &gt; 1 and legendbox == &#039;yes&#039; ) then<br /> cell:attr(&#039;colspan&#039;, columns)<br /> end<br /> local imagediv = cell:tag(&#039;div&#039;)<br /> imagediv:css(&#039;position&#039;,&#039;relative&#039;)<br /> :css(&#039;left&#039;, &#039;0px&#039;)<br /> :css(&#039;top&#039;, &#039;0px&#039;)<br /> :css(&#039;width&#039;, ((grid == &#039;yes&#039;) and 940 or width) .. &#039;px&#039;)<br /> :css(&#039;height&#039;, ((grid == &#039;yes&#039;) and 940 or height) .. &#039;px&#039;)<br /> if grid == &#039;yes&#039; then<br /> imagediv:tag(&#039;span&#039;)<br /> :css(&#039;position&#039;, &#039;absolute&#039;)<br /> :css(&#039;left&#039;, &#039;0px&#039;)<br /> :css(&#039;top&#039;, &#039;0px&#039;)<br /> :css(&#039;z-index&#039;, &#039;2&#039;)<br /> :wikitext(&#039;[[File:Grid 99, 100 int red 50 int yellow (940).svg|940px]]&#039;)<br /> end<br /> imagediv:tag(&#039;span&#039;)<br /> :css(&#039;position&#039;, &#039;absolute&#039;)<br /> :css(&#039;left&#039;, &#039;0px&#039;)<br /> :css(&#039;top&#039;, &#039;0px&#039;)<br /> :css(&#039;z-index&#039;, &#039;0&#039;)<br /> :css(&#039;width&#039;, width .. &#039;px&#039;)<br /> :css(&#039;height&#039;, height .. &#039;px&#039;)<br /> :wikitext(&#039;[[File:&#039; .. image .. &#039;|&#039; .. width .. &#039;x&#039; .. height .. &#039;px]]&#039;)<br /> if overlay == &#039;yes&#039; then<br /> for k = 1,#itemnums do<br /> local i = itemnums[k]<br /> local imagei = (itemdata[k])[1]<br /> for j =0,3 do<br /> local overlayileftj = args[&#039;overlay&#039; .. i .. &#039;left&#039; .. ((j == 0) and &#039;&#039; or j)] or &#039;&#039;<br /> local overlayitopj = args[&#039;overlay&#039; .. i .. &#039;top&#039; .. ((j == 0) and &#039;&#039; or j)] or &#039;&#039;<br /> if overlayileftj ~= &#039;&#039; then<br /> imagediv:tag(&#039;div&#039;)<br /> :css(&#039;position&#039;, &#039;absolute&#039;)<br /> :css(&#039;left&#039;, overlayileftj .. &#039;px&#039;)<br /> :css(&#039;top&#039;, overlayitopj .. &#039;px&#039;)<br /> :css(&#039;line-height&#039;, &#039;95%&#039;)<br /> :css(&#039;z-index&#039;, &#039;1&#039;)<br /> :wikitext(imagei)<br /> end<br /> end<br /> end<br /> end<br /> end<br /> <br /> -- Split the legend items into sub-legends<br /> legend = {{}, {}, {}, {}, {}}<br /> local jmax = itemnums[#itemnums]<br /> for i=1,5 do<br /> if args[&#039;legend&#039; .. i .. &#039;start&#039;] then<br /> -- default is all items<br /> j1 = 0<br /> j2 = jmax<br /> -- set start item number to (legendistart) or (legend(i-1)end + 1)<br /> if args[&#039;legend&#039; .. i .. &#039;start&#039;] then<br /> j1 = tonumber(args[&#039;legend&#039; .. i .. &#039;start&#039;]) or j1<br /> elseif args[&#039;legend&#039; .. (i-1) .. &#039;end&#039;] then<br /> j1 = (tonumber(args[&#039;legend&#039; .. (i-1) .. &#039;end&#039;]) or j1) + 1<br /> end<br /> -- set end item number to (legendiend) or (legend(i+1)start - 1)<br /> if args[&#039;legend&#039; .. i .. &#039;end&#039;] then<br /> j2 = tonumber(args[&#039;legend&#039; .. i .. &#039;end&#039;]) or j2<br /> elseif args[&#039;legend&#039; .. (i+1) .. &#039;start&#039;] then<br /> j2 = (tonumber(args[&#039;legend&#039; .. (i+1) .. &#039;start&#039;]) or j2) - 1<br /> end<br /> -- get the items within the range, marking them as they are used<br /> for k=1,#itemnums do<br /> j = itemnums[k]<br /> if (j &gt;= 0 and j &gt;= j1 and j &lt;= j2) then<br /> table.insert(legend[i], itemdata[k])<br /> itemnums[k] = -1<br /> end<br /> end<br /> end<br /> end<br /> <br /> -- Add any left over items to the first legend<br /> for k = 1,#itemnums do<br /> if itemnums[k] &gt;= 0 then<br /> table.insert(legend[1], itemdata[k])<br /> end<br /> end<br /> <br /> -- Build the legend<br /> if columns &gt; 0 then<br /> for i = 1,5 do<br /> local locallegend = legend[i]<br /> if (locallegend and #locallegend &gt; 0) then<br /> local cell = root:tag(&#039;tr&#039;):tag(&#039;td&#039;)<br /> cell:wikitext(buildlegend(locallegend, columns, border, args[&#039;legend&#039; .. i .. &#039;title&#039;] or &#039;&#039;))<br /> end<br /> end<br /> end<br /> <br /> return tostring(root)<br /> end<br /> <br /> return p</div> Jonesey95