Content deleted Content added
HouseBlaster (talk | contribs) test |
HouseBlaster (talk | contribs) save a WIP |
||
Line 20:
local function add(value)
if value then
value = mw.ustring.lower(mw.text.trim(value))
local applicableSection = args[value .. '-section'] or sectionParameter
value = topicAliases[value] or value -- normalize to the canonical name after we find the applicableSection
Line 201:
local function getTopicBlurb(code)
return frame:expandTemplate{
title = "Contentious topics/list/sandbox",
args = { scope = code }
end▼
local function getSuptopicBlurb(code)
return frame:expandTemplate{
title = "Contentious topics/list",
args = { subtopic = code }
}
end
Line 255 ⟶ 262:
-- if there's only one topic, we make a short blurb
if numberOfTopics == 1 then
local theCTOP
if section then
for topic, part in pairs(partialTopics) do
Line 260 ⟶ 268:
addToMessage( ' Parts of this ' .. articleOrPage
.. (yesno(part, false) and '' or (' about <b>' .. part .. '</b>'))
.. ' relate
.. '</b>, a contentious topic.')▼
end
else
addToMessage(' This ' .. articleOrPage .. ' relates
end
suptopicBlurb = getSuptopicBlurb(theCTOP)
▲ )
if suptopicBlurb ~= '' then
addToMessage(' to <b>' .. suptopicBlurb .. '</b>, part of the contentious topic designation for <b>' .. getTopicBlurb(subtopics[theCTOP]) .. '</b>.')
end
else
Line 409 ⟶ 420:
Categories!!!
We set the restriction categories back in the if underRestrictions loop
to avoid looping through the restrictions twice. So we only need to do some cleanup, check for unknown parameters, and handle nocat
Because nocat is only for the ultra-rare case of demonstration,
Line 415 ⟶ 426:
--]]
-- Start checking for unknown parameters
if yesno(args.nocat) then▼
--
categories = ''▼
▲ else
addCategory(categoryDatabase["all"])▼
▲ end
▲ -- checking for unknown parameters with extensible modules is annoying; the module is primarily intended for hardcoded stuff
-- luckily, it makes use of a table for its main settings, and we can do some clever stuff with that
Line 456 ⟶ 462:
unknownParameterTable['unknown'] = '[[Category:' .. categoryDatabase['unknown'] .. '|_VALUE_' .. currentTitleObject.text .. ']]'
▲ if yesno(args.nocat) then
-- an finally, call the unknownParameterCheck▼
-- then handle nocat by clearing both category-holding parameters
unknownParameterCheck = checkForUnknownParameters(unknownParameterTable, args)▼
▲ categories = ''
unknownParameterCheck = ''
else
-- nocat is not specified, so we add the universal category
▲ addCategory(categoryDatabase["all"])
end
return messageBox .. categories .. unknownParameterCheck
|