Content deleted Content added
simp? |
rewrite logic |
||
Line 27:
end
local
local ns = title.namespace
if title.subjectPageTitle.isRedirect then
Line 43 ⟶ 36:
return resolveFQSgrade('disambig',args)
else
grade = grade and grade:match('^%s*(.-)%s*$'):lower()
if grade=='start' or grade=='stub' then -- Ucfirst
if args[grade]~='no' then
return ucfirst(grade)
end
elseif grade=='b' or grade=='c' then
local mask = mw.loadData('Module:WikiProject banner/config').b_checklist.mask
local isExtended = args.b1 or args.b2 or args.b3 or args.b4 or args.b5 or args.b6
if isExtended then
local some_fail, all_pass = false, true
for i = 1, 6 do
local b_param = args['b'..i] and mask[string.lower(args['b'..i])]
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
end
end
return all_pass and 'B' -- return B if all criteria are marked passed
or some_fail and 'C' -- or return C if any of the criteria are marked failed
or grade:upper() -- otherwise defer to entered grade
elseif args[grade]~='no' then
return grade:upper()
end
elseif grade=='fa' or grade=='fl' or grade=='a' or grade=='ga' then -- Upper-case
if args[grade]~='no' then
return grade:upper()
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
end
end
elseif ns==7 or ns==711 then -- File talk
if grade=='fm' and (args.fm or args.FQS)=='yes' then
return 'FM'
else
return resolveFQSgrade('file', args)
end
elseif ns==15 then -- Category talk
return resolveFQSgrade('category', args)
Line 57 ⟶ 91:
elseif ns==119 then -- Draft talk
return resolveFQSgrade('draft', args)
elseif ns==13 and args['help']=='yes' then -- Help talk
return
elseif ns==3 and args['user']=='yes' then -- User talk
return
else
return 'NA'
end
end
Line 140 ⟶ 102:
p._main = function(args, title)
title = title or mw.title.getCurrentTitle()
local out, warning = '', ''
if title.namespace == 10 and title.subpageText == 'class' then
end
if not args[1] or args[1]=='¬' then -- undefined
out = '¬'
else
out = (getGrade(args, title) or '')
end
return warning .. out
end
|