Content deleted Content added
m streamlining code |
reduce concatenation; prevent repeat cats |
||
Line 1:
local p = {
}
local WRAPPER_TEMPLATE = 'Template:Asbox'
local attention = 'Stub message templates needing attention'▼
▲local args, msgBox, stubCats
function demo(text, alt)
Line 11 ⟶ 9:
end
▲local attention = 'Stub message templates needing attention'
function category(cat)--{{'cat', 'sort'}, 'cat2'} or 'cat'
for _, v in ipairs(type(cat) == type'' and {cat} or cat) do
'[[%sCategory:%s]]',
demo(':', ''),
Line 22 ⟶ 21:
#v[1] < 2 and table.concat(v) or v[2]
)
if not p.cats.inv[p.key] then
table.insert(p.cats, p.key)
p.cats.inv[p.key] = #p.cats
end
end
return cat.done and table.concat(p.cats, demo(' | ', '')) or ''
Line 31 ⟶ 34:
return ''
end
return
type = 'content',
text = v[1]
}
▲ .. category{v[2]}
end
Line 42 ⟶ 45:
stubCats = {
missing = {},
v = {}
}
Line 60 ⟶ 63:
table.insert(stubCats.missing, 'category' .. v)
end
table.insert(stubCats.
or
or
end
end
Line 73 ⟶ 76:
table.insert(stubCats.missed, '<code class="nowrap">|' .. meowFeedMe .. '</code>')
end
--Changed, original: One or more of the stub categories defined in this template do not seem to exist! Please double-check the parameters {{para|category}}, {{para|category1}} and {{para|category2}}.▼
'The following parameter' .. (#stubCats.missing == 1 and ' defines a stub category that does' or 's define stub categories that do') .. ' not exist: ' .. mw.text.listToText(stubCats.missed),▼
{'N', page.text}▼
}▼
end
category(stubCats.v)
return stubCats.
▲
▲
end
Line 103 ⟶ 105:
return category{
'Stub message templates',
'Exclude in print',
▲ --Changed. Original Asbox does its first of 3 checks on params |category#= here.
▲ --Rather than checking multiple times, all operations involving those params have been rolled into catStub()
▲ .. (args.icon and
▲ category'Stub message templates using icon parameter'
nil
or {'B', page.text}
)▼
)
▲ or category'Stub message templates without images'
▲ )
▲ .. (args.imagealt and
▲ category{{'I', page.text}}
▲ or ''
.. ombox{
ifNot = args.category,
|