Content deleted Content added
simplify. No need to assign the value to a variable if we're testing it (both trigger parsing the ref tag) |
move readArgs code into p.navbox |
||
Line 5:
local getArgs -- lazily initialized
local format = string.format
local function readArgs(args, prefix)▼
-- Read the arguments in the order they'll be output in, to make references▼
-- number in the right order.▼
local _▼
-- Limit this to 20 as covering 'most' cases (that's a SWAG) and because▼
-- iterator approach won't work here▼
for i = 1, 20 do▼
_ = args[prefix .. format(cfg.arg.group_and_num, i)]▼
if inArray(cfg.keyword.subgroups, args[prefix .. format(cfg.arg.list_and_num, i)]) then▼
for _, v in ipairs(cfg.keyword.subgroups) do▼
readArgs(args, prefix .. v .. i .. "_")▼
end▼
end▼
end▼
end▼
function p._navbox(args)
Line 579 ⟶ 563:
function p.navbox(frame)
▲ local function readArgs(args, prefix)
▲ _ = args[prefix .. format(cfg.arg.group_and_num, i)]
▲ if inArray(cfg.keyword.subgroups, args[prefix .. format(cfg.arg.list_and_num, i)]) then
▲ for _, v in ipairs(cfg.keyword.subgroups) do
▲ readArgs(args, prefix .. v .. i .. "_")
▲ end
▲ end
▲ end
▲ end
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
local args = getArgs(frame, {wrappers = {cfg.pattern.navbox}})
▲ _ = args[cfg.arg.title]
▲ _ = args[cfg.arg.above]
readArgs(args, "")
▲ _ = args[cfg.arg.below]
return p._navbox(args)
end
|