Content deleted Content added
HouseBlaster (talk | contribs) save a WIP |
HouseBlaster (talk | contribs) refactor |
||
Line 72:
local restrictionFlags = {} -- Track which restrictions are enabled, as a set
local currentTitleObject = mw.title.getCurrentTitle()
local underRestrictions -- a boolean for whether there are any active restrictions
local articleOrPage -- the string "article" (if a mainspace article) or "page" (if not)
local numberOfCompleteTopics = #completeTopics -- the number of complete topics
local numberOfPartialTopics = TableTools.size(partialTopics) -- the number of partial topics (not a sequence, so we have to use TableTools.size)
Line 85 ⟶ 83:
local unknownParameterTable -- the table to pass to the [[Module:Check for unknown parameters]] call
local categories = '' -- initialize categories
local manualRestrictions = false -- have we set any restrictions via |parameters? Set to true when |parameters are processed
--[[
Line 155 ⟶ 153:
-- Add the protection level
if yesno(args.protection, true) or yesno(args.aeprotection, true) then
local protectionLevel =
if protectionLevel then
-- we have a |protection=foo parameter, and the page is protected
Line 296 ⟶ 294:
end
else
-- there is more than one topic, so we have to do some more processing
-- we handle the cases for partialTopics and completeTopics completely seperately
if numberOfCompleteTopics ~= 0 then
-- if there are any complete topics, insert text about them
addToMessage(' The entire ' .. articleOrPage .. ' relates to ')
if numberOfCompleteTopics > 1 then
-- we either loop through adding bullet points
addToMessage('the following contentious topics:\n')
for _, topic in ipairs(completeTopics) do
Line 304 ⟶ 306:
end
else
-- or we do it once
-- TODO: refactor makeTopicBulletPoint into a more versitile function, allowing it to be called here
addToMessage('<b>')
local superTopic = callFromListTemplate(completeTopics[1], 'supertopic')
Line 314 ⟶ 318:
end
if numberOfPartialTopics ~= 0 then
-- if there are any partial topics, insert text about them. Note that this runs regardless of whether there are any completeTopics
addToMessage('<p>')
if numberOfCompleteTopics ~= 0 then
Line 380 ⟶ 385:
end
end
-- restrictions are all added to the banner text. Here we specify a date placed and a tracking category if not but we have manual restrictions
addToMessage('<p>Restrictions placed: ' .. require('Module:Format time')._main{args['placed-date']} .. '</p>')▼
elseif manualRestrictions then▼
addCategory(categoryDatabase['no-date'])▼
end▼
end
Line 394 ⟶ 405:
.. 'the content in question should be marked within the wiki text by an invisible comment. '
.. 'If no comment is present, please ask an administrator for assistance. If in doubt it is better to assume that the content is covered.</p>')
▲ if args['placed-date'] then
▲ addToMessage('<p>Restrictions placed: ' .. require('Module:Format time')._main{args['placed-date']} .. '</p>')
▲ elseif manualRestrictions then
▲ addCategory(categoryDatabase['no-date'])
▲ end
end
|