Content deleted Content added
fix a logical error in quality function for NA-classes, improve some code efficiency |
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)) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 17:
-- Should not be used with non-ascii strings.
return s:sub(1, 1):upper() .. s:sub(2, -1)
end
local resolveFQSgrade = function(grade, args)
if (args[grade] or args.FQS)
return ucfirst(grade)
else
Line 32 ⟶ 27:
end
title = title or mw.title.getCurrentTitle()
local out = ''
local grade = args[1]
if not grade or grade=='¬' then -- undefined
out = '¬'
else
local ns = title.namespace
grade = grade:match('^%s*(.-)%s*$'):lower()
if title.subjectPageTitle.isRedirect then
out = resolveFQSgrade('redirect',args)
elseif ns==1 then -- Talk
else
if grade=='start' or grade=='stub' then -- Ucfirst
out = ucfirst(grade)
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
out = resolveFQSgrade('file', args)
end
elseif ns==15 then -- Category talk
out = resolveFQSgrade('category', args)
elseif ns==101 then -- Portal talk
out = resolveFQSgrade('portal', args)
out = resolveFQSgrade('template', args)
elseif ns==5 then -- Wikipedia talk
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
end
end
return out
end
Line 170 ⟶ 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
Line 191 ⟶ 115:
end
p.readarticleclass = function(
page = page or mw.title.getCurrentTitle().prefixedText
local get_parameter_value = require("Module:Template parameter value").getValue
local WPBSredirects = {'WikiProject banner shell','WikiProject banner shell/sandbox','Bannershell','Multiple wikiprojects','Project shell','Scope shell','WPB','WPBS','WPBannerShell','WP Banner Shell','WP banner shell','WikiProjectBannerShell','WikiProjectBanner Shell','WikiProjectBanners','WikiProject BannerShell','WikiProject Banner Shell','WikiProject Banners','WikiProject Banners Shell','WikiProject Shell','WikiProject banner','WikiProject banner shell/redirect','WikiProject shell','WikiprojectBannerShell','Wikiproject banner holder','Wikiproject banner shell','Wikiprojectbanners','Wikiprojectbannershell','Wpb','Wpbannershell','Wpbsgclass'}
Line 208 ⟶ 133:
class = '¬'
elseif args.QUALITY_CRITERIA ~= 'custom' then -- project uses standard scale and will inherit article class if needed
local article_class = p.readarticleclass(
article_class = article_class and p._main({article_class}, title)
if article_class then -- banner shell exists
if article_class == '' then -- no article class defined
if local_class == '' then -- local class also does not exist, check whether any other class parameters are defined inside the shell
local classparam = p.readarticleclass(
if classparam == '' then -- no class parameters defined, display as globally unassessed
prefix = 'H' -- hide quality class in project banner
|