Content deleted Content added
HouseBlaster (talk | contribs) test |
HouseBlaster (talk | contribs) save a WIP |
||
Line 25:
-- Additional topics via numbered forms
for i = 2, 10 do
add(args[i])
Line 40 ⟶ 39:
local multipleTopics = #topics > 1
local restrictions = {}
local restrictionFlags = {} -- Track which restrictions are set
local currentTitleObject = mw.title.getCurrentTitle()
local subjectTitleObject = currentTitleObject.subjectPageTitle
local messageBody
--
local function addRestriction(restriction)
if yesno(args[restriction]) and not restrictionFlags[restriction] then
restrictionFlags[restriction] = true
table.insert(restrictions, restriction)
end
end
--
addRestriction("0RR")
addRestriction("0RR-nocat")
Line 60:
addRestriction("consensus-required")
--
for _, topic in ipairs(topics) do
local
if topicWide then
addRestriction(restriction)
end▼
end
local
if
for
addRestriction(
end
end
end
--
local
for _, prot in ipairs(protectionLevels) do
addRestriction(prot)
end
--
for _, r in ipairs(restrictions) do
if restrictionsDefinition[r] then
break▼
end▼
local articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"▼
local function makeTopicBulletPoint(code)
return '* <b>' .. frame:expandTemplate{ title = "Contentious topics/list", args = { scope=code } } .. '</b>\n'
end
local function makeRestrictionBulletPoint(code)
local def = restrictionsDefinition[code]
return def and ('* <b>' .. def .. '</b>\n') or ''
end
▲ for _, r in ipairs(restrictions) do
▲ if restrictionsDefinition[r] then
▲ hasRealRestrictions = true
▲ break
▲ end
▲ end
▲ local underRestrictions = hasRealRestrictions
▲ local articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"
messageBody = '<p>The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this '
.. articleOrPage .. '.'
.. (yesno(args.section) and (' Parts of this ' .. articleOrPage .. ' relate ') or (' This ' .. articleOrPage .. ' relates '))
Line 122 ⟶ 112:
messageBody = messageBody .. 'to the following contentious topics:</p>\n'
for _, topic in ipairs(topics) do
messageBody = messageBody .. makeTopicBulletPoint(topic
end
else
messageBody = messageBody .. 'to <b>'
.. frame:expandTemplate{ title = "Contentious topics/list", args = { scope=topics[1] } }
.. '</b>, a contentious topic.</p>'
end
if underRestrictions then
messageBody = '<strong style="text-transform: uppercase;">Warning: active arbitration remedies</strong>'
.. messageBody
.. '<p style="text-decoration:underline;">The following restrictions apply to all editors editing in the topic area:</p>\n'
for _, restriction in ipairs(restrictions) do
messageBody = messageBody .. makeRestrictionBulletPoint(restriction)
Line 146 ⟶ 135:
.. '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>' or '')
local messageBox = require('Module:Message box').main(
["type"] = underRestrictions and "delete" or "content",
▲ {
.. (yesno(args.small) and "30"
["text"] =
})▼
▲ }
▲ )
return messageBox
end
|