Content deleted Content added
HouseBlaster (talk | contribs) save a WIP |
HouseBlaster (talk | contribs) save a WIP |
||
(3 intermediate revisions by the same user not shown) | |||
Line 4:
local yesno = require('Module:Yesno')
local checkForUnknownParameters = require('Module:Check for unknown parameters')._check
local messageBoxModule = require('Module:Message box')
local categoryDatabase = mw.loadJsonData("Template:Contentious topics/Category database.json")
local restrictionsDatabase = mw.loadJsonData("Template:Contentious topics/Additional restrictions.json")
Line 174 ⟶ 175:
-- Add the protection level
if yesno(args.protection, true) or yesno(args.aeprotection, true) then
local protectionLevel = (currentTitleObject.subjectPageTitle.protectionLevels["edit"] or {nil})[1] -- the or {nil} allows a graceful fail if the subjectPage does not (yet) exist
if protectionLevel then
-- we have a |protection=foo parameter, and the page is protected
Line 260 ⟶ 261:
end
-- check for a superTopic (e.g. South Asia is the superTopic of Indian military history)
local superTopic =
if superTopic ~= '' then
-- we have a superTopic, so explain that
Line 309 ⟶ 310:
local subtopicBlurb = getSubtopicBlurb(theCTOP)
if subtopicBlurb ~= '' then
addToMessage(' to <b>' .. subtopicBlurb .. '</b>, ' .. ' part of the contentious topic designation for ' .. makeSubtopicCompleteBlurb(theCTOP))
else
Line 330:
-- TODO: refactor makeTopicBulletPoint into a more versitile function, allowing it to be called here
addToMessage('<b>')
local superTopic =
if superTopic ~= '' then
addToMessage(getSubtopicBlurb(completeTopics[1]) .. '</b>, part of the contentious topic designation for ' .. makeSubtopicCompleteBlurb(completeTopics[1]))
else
Line 360:
-- There's only one topic and scope, so this loop only runs once
for topic, scope in pairs(partialTopics) do
if superTopic ~= '' then
addToMessage('<b>' .. getSubtopicBlurb(topic) .. '</b>')
else
addToMessage('<b>' .. getTopicBlurb(topic) .. '</b>')
end
if yesno(scope, nil) == nil then
-- the scope is not a boolean value, so we have a free-text explanation of the applicable parts
addToMessage(', in particular the parts about <b>' .. scope .. '</b>')
end
if superTopic ~= '' then
addToMessage('. This is a subtopic of
else
addToMessage('.</p>')
Line 430 ⟶ 434:
-- Now build the messageBox
messageBox =
["type"] = underRestrictions and "delete" or "content",
["image"] = "[[File:Commons-emblem-"
.. (underRestrictions and "hand" or "issue")
.. ".svg|40px]]",
["text"] = messageBody
})
Line 443 ⟶ 444:
-- If ECR is enabled, prepend the ECR warning
if restrictionFlags["ECR"] then
.. messageBox▼
-- Hard code for [[WP:BER]]
if TableTools.inArray(completeTopics, "a-i") then
Line 453 ⟶ 449:
addCategory("Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict")
end
-- Then build the ECR box
messageBox = messageBoxModule.main("tmbox", {
["class"] = "nonextendedconfirmed-show ECR-edit-request-warning",
["style"] = "background: var(--background-color-destructive-subtle, #ffe9e5); border-color: var(--border-color-destructive, #f54739); color: var(--color-base, #202122);",
["image"] = "[[File:Commons-emblem-hand.svg|40px]]"
▲ }).. messageBox
end
Line 484 ⟶ 487:
addKnownParameter('relatedcontent')
addKnownParameter('section')
-- then add all of the partialTopics section parameters
for code, _ in pairs(partialTopics) do
|