Content deleted Content added
HouseBlaster (talk | contribs) more extensible |
HouseBlaster (talk | contribs) redundant-stuff-be-gone |
||
Line 88:
for _, prot in ipairs(protectionLevels) do
if restrictionsDefinition[prot] then
end
end
--[[
--]]
-- helper function which clears all revert rules, except for the given one
local function clearOtherRevertRules(rr)
restrictionFlags["0RR"] = nil
restrictionFlags["0RR-nocat"] = nil
restrictionFlags["1RR"] = nil
restrictionFlags["1RR-nocat"] = nil
restrictionFlags[rr] = true
--make sure you handle the case with all revert rules active correctly!
if
clearOtherRevertRules("0RR")
elseif restrictionFlags["0RR-nocat"] then
clearOtherRevertRules("0RR-nocat")
▲ end
elseif restrictionFlags["1RR"] then
clearOtherRevertRules("1RR")
end
-- if we make it to this point, 1RR-nocat is the only one potentially enabled
-- so we don't make a seperate check for it
-- clear BRD if consensus-required is enabled
if restrictionFlags["consensus-required"] then restrictionFlags["BRD"] = nil end
restrictions = setToList(restrictionFlags)
--[[
Restrictions are now all set. Here, we add additional helper functions and variables necessary for generating the banner
--]]
-- Check whether any of the added restrictions are enabled
local underRestrictions = #restrictions > 0
-- Determines whether we should use the string "article" or "page"
local articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"
-- Makes a bullet point for a given contentious topic
local function makeTopicBulletPoint(code)
topicBlurb = frame:expandTemplate{ title = "Contentious topics/list", args = { scope=code } }
Line 115 ⟶ 139:
end
end
-- Makes a restriction bullet point
local function makeRestrictionBulletPoint(code)
local def = restrictionsDefinition[code]
Line 121 ⟶ 146:
end
--[[
messageBody = "<p>'''The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this "▼
Begin building the messageBody
.. articleOrPage .. ".'''"▼
--]]
▲ messageBody =
.. (yesno(args.section) and (' Parts of this ' .. articleOrPage .. ' relate ') or (' This ' .. articleOrPage .. ' relates '))
|