Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Mr. Stradivarius (make the category attempt order more configurable) |
Enwikipedia>Mr. Stradivarius (fix category name function comments) |
||
Line 195: | Line 195: | ||
--[[ |
--[[ |
||
-- Define the |
-- Define the properties table. Each property is a table containing the |
||
-- |
-- canonical order that the property is tested in, the position the |
||
-- |
-- property has in the category key strings, and the property value itself. |
||
--]] |
--]] |
||
local properties = { |
local properties = { |
||
Line 208: | Line 208: | ||
--[[ |
--[[ |
||
-- Load the category order configuration for the reason specified. |
|||
-- Validate reason, and if it is specified as a "namespaceFirst" reason, |
|||
-- The configuration is stored in the categoryOrder field of each reason |
|||
-- move the namespace subtable to the end of the properties table. |
|||
-- subtable of cfg.reasons. If the value is a table, then the order is the |
|||
-- This is necessary to accommodate reasons like "vandalism", as the old |
|||
-- values specified in the table. If the value is a string, then the |
|||
-- {{pp-vandalism}} template used namespace categories rather than |
|||
-- property corresponding to that string is tested last (i.e. it is the most |
|||
-- vandalism categories if they were available. |
|||
-- important, because it keeps its specified value the longest) and the |
|||
-- other properties are tested in the canonical order. If the value is of |
|||
-- any other type then the canonical order is used. |
|||
--]] |
--]] |
||
local reasonTable = cfg.reasons[reason] |
local reasonTable = reason and cfg.reasons[reason] |
||
local categoryOrder = reasonTable and reasonTable.categoryOrder |
local categoryOrder = reasonTable and reasonTable.categoryOrder |
||
local categoryOrderType = type(categoryOrder) |
local categoryOrderType = type(categoryOrder) |