Module:Class mask: Difference between revisions

Content deleted Content added
add SI as alias for List; help and user not part of FQS
m Changed protection settings for "Module:Class mask": most less used now (although number of transclusions has not caught up) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
 
(2 intermediate revisions by the same user not shown)
Line 27:
end
 
local resolveExtraGradep._main = function(gradeargs, argstitle)
title = title or mw.title.getCurrentTitle()
if args[grade]=='yes' then
local out = ''
return ucfirst(grade)
else
return 'NA'
end
end
 
local resolveDefaultGrade = function(args, title, talkDefault)
local ns = title.namespace
if title.subjectPageTitle.isRedirect then
return resolveFQSgrade('redirect',args)
elseif ns==1 then -- Talk
if require('Module:Disambiguation').isDisambiguation(title.subjectPageTitle:getContent()) then
return resolveFQSgrade('disambig',args)
else
return talkDefault
end
elseif ns==7 or ns==711 then -- File talk
return resolveFQSgrade('file', args)
elseif ns==15 then -- Category talk
return resolveFQSgrade('category', args)
elseif ns==101 then -- Portal talk
return resolveFQSgrade('portal', args)
elseif ns==11 or ns==829 then -- Template talk
return resolveFQSgrade('template', args)
elseif ns==5 then -- Wikipedia talk
return resolveFQSgrade('project', args)
elseif ns==119 then -- Draft talk
return resolveFQSgrade('draft', args)
elseif ns==13 then -- Help talk
return resolveExtraGrade('help', args)
elseif ns==3 then -- User talk
return resolveExtraGrade('user', args)
else
return 'NA'
end
end
 
local getGrade = function(args, title)
local grade = args[1]
grade = grade and grade:match('^%s*(.-)%s*$'):lower()
if not grade or grade=='¬' then -- undefined
returnout = '¬'
else
elseif grade=='start' or grade=='stub' then -- Ucfirst
local ns = title.namespace
if args[grade]~='no' then
grade = grade:match('^%s*(.-)%s*$'):lower()
return ucfirst(grade)
if title.subjectPageTitle.isRedirect then
end
out = resolveFQSgrade('redirect',args)
elseif grade=='b' or grade=='c' then
elseif ns==1 then -- Talk
local mask = mw.loadData('Module:WikiProject banner/config').b_checklist.mask
if require('Module:Disambiguation').isDisambiguation(title.subjectPageTitle:getContent()) then
local isExtended = args.b1 or args.b2 or args.b3 or args.b4 or args.b5 or args.b6
out = resolveFQSgrade('disambig',args)
if isExtended then
else
local some_fail, all_pass = false, true
if grade=='start' or grade=='stub' then -- Ucfirst
for i = 1, 6 do
if args[grade]~='no' then
local b_param = args['b'..i] and mask[string.lower(args['b'..i])]
out = ucfirst(grade)
if b_param and b_param~='y' and b_param~='x' then -- criterion in use and is not passed or marked not applicable
all_pass = false
if b_param=='n' then
some_fail = true
end
elseif grade=='b' or grade=='c' or grade=='fa' or grade=='fl' or grade=='a' or grade=='ga' then -- Upper-case
if args[grade]~='no' then
out = grade:upper()
end
elseif args[grade:upper()] then -- Upper-case syntax
out = args[grade:upper()]
elseif args[grade:lower()]=='yes' then -- Lower-case syntax
out = mw.language.getContentLanguage():ucfirst(grade:lower())
elseif grade=='list' or grade=='sia' or grade=='si' or grade=='sl' then-- List
if args['list']~='no' then
out = 'List'
end
elseif grade=='dab' or grade=='disambig' or grade=='disambiguation' or grade=='disamb' then
out = resolveFQSgrade('disambig', args)
end
end
elseif ns==7 or ns==711 then -- File talk
return all_pass and 'B' -- return B if all criteria are marked passed
if grade=='fm' and (args.fm or args.FQS)=='yes' then
or some_fail and 'C' -- or return C if any of the criteria are marked failed
out = 'FM'
or grade:upper() -- otherwise defer to entered grade
else
elseif args[grade]~='no' then
out = resolveFQSgrade('file', args)
return grade:upper()
end
elseif gradens=='fa' or grade=='fl' or grade=='a' or grade=='ga'15 then -- Upper-caseCategory talk
out = resolveFQSgrade('category', args)
if args[grade]~='no' then
elseif ns==101 then -- Portal talk
return grade:upper()
out = resolveFQSgrade('portal', args)
end
elseif gradens=='na'11 or ns==829 then -- Template talk
out = resolveFQSgrade('template', args)
if args.forceNA=='yes' then
elseif ns==5 then -- Wikipedia talk
return resolveDefaultGrade(args, title, 'NA')
out = resolveFQSgrade('project', args)
elseif ns==119 then -- Draft talk
out = resolveFQSgrade('draft', args)
elseif ns==13 and args['help']=='yes' then -- Help talk
out = 'Help'
elseif ns==3 and args['user']=='yes' then -- User talk
out = 'User'
else
returnout = 'NA'
end
elseif grade=='file' or grade=='image' or grade=='img' then
return resolveFQSgrade('file', args)
elseif grade=='category' or grade=='cat' or grade=='categ' then
return resolveFQSgrade('category', args)
elseif grade=='dab' or grade=='disambig' or grade=='disambiguation' or grade=='disamb' then
return resolveFQSgrade('disambig', args)
elseif grade=='redirect' or grade=='red' or grade=='redir' then
return resolveFQSgrade('redirect', args)
elseif grade=='portal' or grade=='project' or grade=='draft' then
return resolveFQSgrade(grade, args)
elseif grade=='template' or grade=='temp' or grade=='tpl' or grade=='templ' then
return resolveFQSgrade('template', args)
elseif grade=='help' or grade=='user' then
return resolveExtraGrade(grade, args)
elseif grade=='fm' then
if (args.fm or args.FQS)=='yes' then
return 'FM'
else
return resolveFQSgrade('file', args)
end
elseif args[grade:upper()] then -- Upper-case syntax
return args[grade:upper()]
elseif args[grade:lower()]=='yes' then -- Lower-case syntax
return mw.language.getContentLanguage():ucfirst(grade:lower())
elseif grade=='list' or grade=='sia' or grade=='si' or grade=='sl' then-- List
if args['list']~='no' then
return 'List'
end
else -- Defaults
return resolveDefaultGrade(args, title)
end
end
 
p._main = function(args, title)
title = title or mw.title.getCurrentTitle()
local out = ''
if title.namespace == 10 and title.subpageText == 'class' then
out = mw.getCurrentFrame():expandTemplate{title = 'Class mask/doc warning'}
end
out = out .. (getGrade(args, title) or '')
return out
end
Line 150 ⟶ 91:
p.main = function(frame)
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame, {
removeBlanks = false,
wrappers = 'Template:Class mask'
})
return p._main(args)
end