Module:Contentious topics/talk notice: Difference between revisions

Content deleted Content added
sync with sandbox which contains better section support, better support for date formatting, checking for unknown parameters, code refactoring, and other improved functionality
 
(6 intermediate revisions by 2 users not shown)
Line 60:
local currentTitleObject = mw.title.getCurrentTitle()
local subjectTitleObject = currentTitleObject.subjectPageTitle
local section = sectionParameter or #partialTopics > 0 -- whether any topics apply to parts of the article
local underRestrictions -- a boolean for whether there are any active restrictions
local articleOrPage -- the string "article" (if a mainspace article) or "page" (if not)
Line 67 ⟶ 66:
local numberOfPartialTopics = TableTools.size(partialTopics) -- the number of partial topics (not a sequence, so we have to use TableTools.size)
local numberOfTopics = numberOfCompleteTopics + numberOfPartialTopics -- total number of topics
local section = sectionParameter or #partialTopicsnumberOfPartialTopics > 0 -- whether any topics apply to parts of the article
local messageBody -- the text within the message box
local messageBox -- the message box itself
Line 244:
addToMessage(' This ' .. articleOrPage .. ' relates to <b>'
.. getTopicBlurb(completeTopics[1])
.. '</b>, a contentious topic.</p>'
)
end
Line 268:
addToMessage('of this ' .. articleOrPage .. ' relate to ')
if numberOfPartialTopics > 1 then
addToMessage('the following contentious topics:</p>\n')
for topic, scope in pairs(partialTopics) do
if yesno(scope, false) then
Line 283:
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>.')
else
addToMessage('.')
end
addToMessage('.</p>')
end
end
Line 327 ⟶ 326:
if not yesno(args.brief) then
addToMessage(' <p>Editors who repeatedly or seriously fail to adhere to the [[WP:Five pillars|purpose of Wikipedia]], '
.. 'any expected [[WP:Etiquette|standards of behaviour]], '
.. 'or any [[WP:List of policies|normal editorial process]] may be blocked or restricted by an administrator.</p>')
end
Line 415 ⟶ 414:
-- then all the various topic parameters. Table is no longer a sequence; perform any computation requring a sequence above
unknownParameterTable['regexp1'] = 'topic[%d]+*'
unknownParameterTable['regexp2'] = 't[%d]+*'
unknownParameterTable['regexp3'] = '[%d]+'
unknownParameterTable['regexp4'] = 'other[%d]*'
 
-- set the tracking category
unknownParameterTable['unknown'] = '[[Category:' .. categoryDatabase['unknown'] .. '|_VALUE_' .. currentTitleObject.text .. ']]'
-- an finally, call the unknownParameterCheck