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

Content deleted Content added
for WP:BER
cleanup, refactor
Line 174:
local function addToMessage(s)
messageBody = messageBody .. s
end
local function makeTopicBulletPointgetTopicBlurb(code, )
..return frame:expandTemplate {
title = "Contentious topics/list",
args = { scope = topiccode }
}
end
Line 180 ⟶ 187:
-- and is nil if it applies to the entire page or unspecified parts of the page
local function makeTopicBulletPoint(code, scope)
topicBlurb = frame:expandTemplate{ title = "Contentious topics/list", args = { scope=getTopicBlurb(code } })
if topicBlurb == '' then
addCategory(categoryDatabase['bad-topic'])
Line 192 ⟶ 199:
end
--[[ Makes a bullet point for a given contentious topic
local function makeTopicBulletPoint(code, )
topicBlurb = frame:expandTemplate{ title = "Contentious topics/list", args = { scope=code } }
if topicBlurb == '' then
addCategory(categoryDatabase['bad-topic'])
return ''
elseif section then
-- we have some partial sections, so we check whether this is one of them
if partialTopics[code] then
if yesno(partialTopics[code], false) then
-- not given any explicit detail about what applies to the contentious topic, so we specify nothing in particular
return '* <b><span style="text-decoration:underline;">Parts relate to</span> ' .. topicBlurb '</b>\n'
else
-- we are told exactly what parts of the article apply
return '* <b>' .. partialTopics[code] .. ' relate to ' .. topicBlurb '</b>\n'
end
else
return '* <b>' .. topicBlurb .. '</b>\n'
end
end
--]]
-- Makes a restriction bullet point
local function makeRestrictionBulletPoint(code)
Line 221 ⟶ 206:
--[[
Place into errorError categories
--]]
Line 235 ⟶ 220:
messageBody = '<b>The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this ' .. articleOrPage .. '.</b>'
-- .. (section and (' Parts of this ' .. articleOrPage .. ' relate ') or (' This ' .. articleOrPage .. ' relates '))
-- if there's only one topic, we make a short blurb
if numberOfTopics == 1 then
Line 245 ⟶ 228:
.. (yesno(part, false) and '' or (' about <b>' .. part .. '</b>'))
.. ' relate to <b>'
.. frame:expandTemplate { getTopicBlurb(topic)
title = "Contentious topics/list",
args = { scope = topic }
}
.. '</b>, a contentious topic.')
end
else
addToMessage(' This ' .. articleOrPage .. ' relates to <b>'
.. getTopicBlurb(completeTopics[1])
.. frame:expandTemplate {
title = "Contentious topics/list",
args = { scope = completeTopics[1] }
}
.. '</b>, a contentious topic.</p>'
)
Line 270 ⟶ 247:
end
else
addToMessage('<b>' .. frame:expandTemplate{getTopicBlurb(completeTopics[1]) .. '</b>, a contentious topic.</p>')
title = "Contentious topics/list",
args = { scope = completeTopics[1] }
}
.. '</b>, a contentious topic.</p>'
)
end
end
Line 290 ⟶ 262:
addToMessage('the following contentious topics:\n')
for topic, scope in pairs(partialTopics) do
if not yesno(scope, false) then
-- wethe havescope aparameter blurbis explainingsomething whatlike the'yes', scopewhich we can treat fallsas undernil
makeTopicBulletPoint(topic, nil)
else
Line 300 ⟶ 272:
-- There's only one topic and scope, so this loop only runs once
for topic, scope in pairs(partialTopics) do
addToMessage(frame:expandTemplate{getTopicBlurb(topic))
title = "Contentious topics/list",
args = { scope = partialTopics[topic] }
}
)
if yesno(scope, nil) == nil then
-- the scope is not a boolean value, so we have a free-text explanation of the applicable parts