Module:Navbox: Difference between revisions

477 bytes removed ,  5 years ago
The revision 41155 by Hapsbro(talk) has been undone.
((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)
(The revision 41155 by Hapsbro(talk) has been undone.)
Tag: Undo
 
(4 intermediate revisions by 2 users not shown)
Line 287:
 
local function hasBackgroundColors()
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do
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
end
Line 320 ⟶ 312:
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
if hasBorders() then table.insert(cats, 'Navboxes using borders') end
return cats
end
Line 435 ⟶ 426:
getArgs = require('Module:Arguments').getArgs
end
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.