Module:Navbox/sandbox: Difference between revisions

Content deleted Content added
this is Module:Navbox using tabs for indentation; clean whitespace
minor tweaks
Line 12:
local border
local listnums = {}
 
local function trim(s)
return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))
end
 
local function addNewline(s)
Line 258 ⟶ 254:
 
local function needsHorizontalLists()
if border == 'child' or border == 'subgroup' or args.tracking == 'no' then
return false end
 
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
for i, cls in ipairs(listClasses) do
if args.listclass == cls or args.bodyclass == cls then
return false
end
end
local listClasses = {
 
['plainlist'] = true, ['hlist'] = true, ['hlist hnum'] = true,
return true
['hlist hwrap'] = true, ['hlist vcard'] = true, ['vcard hlist'] = true,
['hlist vevent'] = true,
}
return not (listClasses[args.listclass] or listClasses[args.bodyclass])
end
 
local function hasBackgroundColors()
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle'}) do
return mw.ustring.match(args.titlestyle or '','background') or mw.ustring.match(args.groupstyle or '','background') or mw.ustring.match(args.basestyle or '','background')
if tostring(args[key]):find('background', 1, true) then
return falsetrue
end
end
end
 
Line 353 ⟶ 352:
table.sort(listnums)
 
border = mw.text.trim(args.border or args[1] or '')
 
-- render the main body of the navbox