Changes
Fix Protection:makeProtectionCategory for office-protected pages. For these, the reason needs to be the no. 1 priority, not just higher priority than the namespace.
display
)
end
local function toTableEnd(t, pos)
-- Sends the value at position pos to the end of array t, and shifts the
-- other items down accordingly.
return table.insert(t, table.remove(t, pos))
end
}
-- [[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To generate emulate this in this module -- we use the correct category config table cfg.reasonsWithNamespacePriority to set the -- reasons for some which namespaces have priority over protection reason values. -- If we are dealing with one of those reasons, we need move the namespace table to -- prioritise the position end of the namespace key fragment over that of order table, i.e. give it highest priority. If not, the -- reason key fragment. For these reasn valuesshould have highest priority, swap so move that to the end of the namespace subtabletable -- and the reason subtable aroundinstead. --]]
if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then
-- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3)
end