Module:Contentious topics/talk notice/sandbox: Difference between revisions

Content deleted Content added
bug squashing
save a WIP
Line 3:
local yesno = require('Module:Yesno')
local setToList = require('Module:Set to list')
local checkForUnknownParameters = require('Module:Check for unknown parameters')._check
local restrictionsDatabase = mw.loadJsonData("Template:Contentious topics/Additional restrictions.json")
local restrictionsDefinition = mw.loadJsonData("Template:Contentious topics/Restrictions definition.json")
Line 12 ⟶ 13:
local completeTopics = {}
local partialTopics = {}
local i = 2 -- initialize index
local keepGoing = true -- whether to keep checking for more CTOPs
local function add(value)
Line 24 ⟶ 27:
end
seen[value] = true
keepGoing = true
end
end
Line 29 ⟶ 33:
 
-- Primary topic params
add(args.topic[1])
add(args.t)
add(args[1].topic)
 
-- Additional topics via numbered forms
forwhile i = 2, 10keepGoing do
keepGoing = false -- this is set back to true if any of the below are found
add(args[i])
add(args[i])
add(args['t' .. i])
add(args['topic' .. i])
i = i + 1 -- increment the index
end
Line 53 ⟶ 59:
local section = sectionParameter or #partialTopics > 0 -- whether any topics apply to parts of the article
local underRestrictions -- a boolean for whether there are any active restrictions
local articleOrPage -- the string "article" (if a mainspace pagearticle) or "page" (if not)
local protectionLevel -- the edit protection level
local numberOfTopics -- positive int which represents the number of topics
local messageBody -- the text within the message box
local messageBox -- the message box itself
local unknownParameterCheck -- the magic container for [[Module:Check for unknown parameters]]
local categories = '' -- initialize categories
local manualRestrictions = false -- have we set any restrictions via |parameters?
Line 380 ⟶ 387:
end
unknownParameterCheck = checkForUnknownParameters(
return messageBox .. categories
)
return messageBox .. categories .. unknownParameterCheck
end