Module:Navbox: Difference between revisions
Remove redundant arghash calculation |
Winterfoxo (talk | contribs) m 1 revision imported from wikipedia:Module:Navbox |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 771: | Line 771: | ||
row = coltable:tag('tr') | row = coltable:tag('tr') | ||
for k, n in ipairs(colheadernums) do | for k, n in ipairs(colheadernums) do | ||
col = row:tag(' | col = row:tag('th'):addClass('navbox-abovebelow') | ||
col:cssText(concatstyles({ | col:cssText(concatstyles({ | ||
(k > 1) and 'border-left:2px solid #fdfdfd' or '', | (k > 1) and 'border-left:2px solid #fdfdfd' or '', | ||
| Line 852: | Line 852: | ||
function p.navbox (frame, boxtype) | function p.navbox (frame, boxtype) | ||
local function readArgs(args, prefix) | local function readArgs(args, prefix) | ||
local function readSubgroups(element, i) | |||
if inArray(cfg.keyword.subgroups, args[prefix .. andnum(element, i)]) then | |||
for _, v in ipairs(cfg.arg.subgroups_and_num) do | |||
readArgs(args, prefix .. string.format(v, i) .. "_") | |||
end | |||
readArgs(args, prefix .. andnum('col', i) .. "_") | |||
end | |||
end | |||
-- Read the arguments in the order they'll be output in, to make references | -- Read the arguments in the order they'll be output in, to make references | ||
-- number in the right order. | -- number in the right order. | ||
| Line 859: | Line 867: | ||
-- Limit this to 20 as covering 'most' cases (that's a SWAG) and because | -- Limit this to 20 as covering 'most' cases (that's a SWAG) and because | ||
-- iterator approach won't work here | -- iterator approach won't work here | ||
local boxtype = args.type or cfg.keyword[boxtype] | |||
if boxtype == cfg.keyword.with_columns then | |||
for i = 1, 20 do | |||
_ = args[prefix .. andnum('colheader', i)] | |||
end | |||
for i = 1, 20 do | |||
readSubgroups('col', i) | |||
end | |||
for i = 1, 20 do | |||
_ = args[prefix .. andnum('colfooter', i)] | |||
end | |||
end | |||
for i = 1, 20 do | for i = 1, 20 do | ||
_ = args[prefix .. andnum('group', i)] | _ = args[prefix .. andnum('group', i)] | ||
readSubgroups('list', i) | |||
end | end | ||
_ = args[prefix .. cfg.arg.below] | _ = args[prefix .. cfg.arg.below] | ||