Jump to content

Module:Protection banner: Difference between revisions

fix category name function comments
(make the category attempt order more configurable)
(fix category name function comments)
Line 195: Line 195:


--[[
--[[
-- Define the initial order to test properties in. The subtable position
-- Define the properties table. Each property is a table containing the
-- is the order the properties will be tested in, and the keypos value in
-- canonical order that the property is tested in, the position the
-- each subtable is the position of the value in the category key.
-- property has in the category key strings, and the property value itself.
--]]
--]]
local properties = {
local properties = {
Line 208: Line 208:


--[[
--[[
-- Validate reason, and if it is specified as a "namespaceFirst" reason,
-- Load the category order configuration for the reason specified.
-- move the namespace subtable to the end of the properties table.
-- The configuration is stored in the categoryOrder field of each reason
-- This is necessary to accommodate reasons like "vandalism", as the old
-- subtable of cfg.reasons. If the value is a table, then the order is the
-- {{pp-vandalism}} template used namespace categories rather than
-- values specified in the table. If the value is a string, then the
-- vandalism categories if they were available.
-- property corresponding to that string is tested last (i.e. it is the most
-- 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)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.