Module:Protection banner: Difference between revisions
try adding an exception
(try a different category matching algorithm completely) |
(try adding an exception) |
||
Line 134: | Line 134: | ||
end | end | ||
-- Define the key table and the order to test it in | -- Define the key table and the order to test it in. | ||
-- This part is a little like playing regex golf - we have to make up a new | |||
-- rule for every idiosyncracy that was in the old template system. | |||
local keyTable = {protType, protLevel, namespace, reason, expiry} | local keyTable = {protType, protLevel, namespace, reason, expiry} | ||
local attemptOrder = { | local attemptOrder = { | ||
{true, true, true, true, true}, | -- type, level, ns, reason, expiry | ||
{true, true, true, true, false}, | {true, true, true, true, true}, -- 1 | ||
{true, true, true, false, true}, | {true, true, true, true, false}, -- 2 | ||
{true, true, false, true, true}, | {true, true, true, false, true}, -- 3 | ||
{true, true, true, false, false}, | {true, true, false, true, true}, -- 4 | ||
{true, true, false, true, false}, | {true, true, true, false, false}, -- 5 | ||
{true, true, false, false, true}, | {true, true, false, true, false}, -- 6 | ||
{true, true, false, false, false}, | {true, true, false, false, true}, -- 7 | ||
{true, false, false, false, false}, | {true, true, false, false, false}, -- 8 | ||
{false, false, false, false, false} | {true, false, false, false, false}, -- 9 | ||
{false, false, false, false, false} -- 10 | |||
} | } | ||
if reason == 'vandalism' then | |||
attemptOrder[3], attemptOrder[4] = attemptOrder[4], attemptOrder[3] | |||
attemptOrder[5], attemptOrder[6] = attemptOrder[6], attemptOrder[5] | |||
end | |||
-- Try successively generic matches until we run out of key combinations | -- Try successively generic matches until we run out of key combinations |