Module:Navbox: Difference between revisions

(1) add tracking for css borders in group/above/belowstyle (2) extended background colour check to above and belowstyle (3) add Johnuniq's change to enable using this module directly in Navbox subgroup
en>Matt Fitzpatrick
(removed .navbox-spacing-temp mask, no longer used by site CSS)
en>Frietjes
((1) add tracking for css borders in group/above/belowstyle (2) extended background colour check to above and belowstyle (3) add Johnuniq's change to enable using this module directly in Navbox subgroup)
Line 287: Line 287:


local function hasBackgroundColors()
local function hasBackgroundColors()
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle'}) do
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do
if tostring(args[key]):find('background', 1, true) then
if tostring(args[key]):find('background', 1, true) then
return true
end
end
end
local function hasBorders()
for _, key in ipairs({'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do
if tostring(args[key]):find('border', 1, true) then
return true
return true
end
end
Line 312: Line 320:
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
if hasBorders() then table.insert(cats, 'Navboxes using borders') end
return cats
return cats
end
end
Line 426: Line 435:
getArgs = require('Module:Arguments').getArgs
getArgs = require('Module:Arguments').getArgs
end
end
args = getArgs(frame, {wrappers = 'Template:Navbox'})
args = getArgs(frame, {wrappers = {'Template:Navbox', 'Template:Navbox subgroup'}})
if frame.args.border then
-- This allows Template:Navbox_subgroup to use {{#invoke:Navbox|navbox|border=...}}.
args.border = frame.args.border
end


-- Read the arguments in the order they'll be output in, to make references number in the right order.
-- Read the arguments in the order they'll be output in, to make references number in the right order.
Anonymous user