Module:WikiProject quality assessment
Documentation for this module may be created at Module:WikiProject quality assessment/doc
require('strict') local p = {} local class_mask = require('Module:Class mask')._main local readarticleclass = function() -- look for article_class in page content 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'} local target = mw.title.getCurrentTitle().prefixedText local success, result = get_parameter_value(target, WPBSredirects, "class", {ignoreSubtemplates=true}) return success and result end local getclass = function(args) local class = '¬' if args.QUALITY_SCALE == 'inline' then class = args.class elseif args.QUALITY_SCALE == 'subpage' then if mw.title.new(args.BANNER_NAME..'/class').exists then local frame = mw.getCurrentFrame() class = frame:expandTemplate{title = args.BANNER_NAME..'/class', args = args} end else args.FQS = (args.QUALITY_SCALE == 'extended') and 'yes' or 'no' args[1] = args.class class = class_mask(args) end return class end local isarticle = function(class) local nonarticleclasses = {'Template', 'File', 'Category', 'Disambig', 'Redirect', 'Portal', 'Project', 'Draft', 'Book', 'FM'} -- these classes will not be identified as conflicting with NA-class local article = true for _,v in ipairs(nonarticleclasses) do if class==v then -- class matches one of the non-article classes article = false break end end return article end p.main = function(frame) local local_class = getclass(frame.args) local prefix, class = 'Y', local_class if local_class=='¬' then class = '¬' elseif frame.args.QUALITY_CRITERIA ~= 'custom' then -- project uses standard scale and will inherit article class if needed local article_class = frame.args.article_class or readarticleclass() -- checks parameter for testing purposes article_class = article_class and class_mask{article_class, ignorenamespace=frame.args.ignorenamespace} or '¬' -- normalise if not false if (article_class == '¬') or (article_class == '') then -- article class does not exist, display quality class in project banner as normal elseif (local_class == '') or (local_class == article_class) then -- article class and local class are the same, or local is not specified prefix = 'H' -- hide quality class in project banner class = article_class elseif (article_class == 'NA') and not isarticle(local_class) then -- article class and local class are both non-article classes prefix = 'H' else -- article class exists and differs from local class prefix = 'X' -- X will indicate to meta banner that classes are different, so trigger a tracking category end end return (frame.args.noprefix and '' or prefix) .. class end return p