Anonymous user
Module:Protection banner: Difference between revisions
key components are in the correct order now - property order still a long way off, though
Enwikipedia>Mr. Stradivarius (change this to something that should work if I can get the order figured out) |
Enwikipedia>Mr. Stradivarius (key components are in the correct order now - property order still a long way off, though) |
||
Line 84:
local tconcat = table.concat
local tinsert = table.insert
local tremove = table.remove
local floor = math.floor
local function toTableEnd(t, pos)
-- Sends the item at position pos to the end of array t,
-- and shifts all the other array items down accordingly.
tinsert(t, tremove(t, pos))
local p = {}
Line 92 ⟶ 99:
-- namespace parameter of p.getCategoryName.
if not ns or type(ns) ~= 'number' then
return
end
local nskey = nskeys[ns]
if not nskey and ns % 2 == 1 then
if ns % 2 == 1 then▼
nskey = 'talk'
else▼
nskey = 'all'▼
end▼
end
return nskey
Line 109 ⟶ 112:
-- the protection type, the protection level, the namespace number, the
-- reason for protection, and the expiry date.
cats = cats or categories
local properties = {}▼
if not expiry then▼
elseif expiry ~= 'indef' then▼
▲ end
{pos = 5, val = expiry},
local behavior = behaviors[reason]▼
{pos = 3, val = namespace},
if behavior == 'namespaceFirst' then▼
{pos = 2, val = protLevel},
tinsert(order, table.remove(order, 2)) -- move namespace to the end▼
{pos = 1, val = protType},
elseif behavior ~= 'reasonFirst' and reason ~= 'all' then▼
▲ }
error(reason .. ' is not a valid reason')
▲ end
end
local
for i,
if
▲ else
inactive[#inactive + 1] = t
end
end
local
local attemptOrder = active
for i,
attemptOrder[#attemptOrder + 1] = t
local categoryKey = {}▼
end
for pos = 1, 5 do▼
for j, t in ipairs(attemptOrder) do
local pos = t.pos
local val = t.val
else
local quotient = i / 2 ^ (
quotient = floor(quotient)
if quotient % 2 == 1 then
else
end
end
end
mw.log(
local attempt = cats[
if attempt then
return attempt
|