Content deleted Content added
sync to live |
use getclass function Tag: Reverted |
||
Line 51:
end
return article
end▼
local getclass = function(args, title)
local class
if args.QUALITY_SCALE == 'inline' then▼
elseif args.QUALITY_SCALE == 'subpage' then▼
local frame = mw.getCurrentFrame()
class = frame:expandTemplate{▼
title = custom_mask.prefixedText,▼
args = raw_args▼
}▼
else▼
FQS = args.QUALITY_SCALE=='extended' and 'yes' or 'no',▼
[1] = raw_args.class,▼
b1 = raw_args.b1, b2 = raw_args.b2, b3 = raw_args.b3, b4 = raw_args.b4, b5 = raw_args.b5, b6 = raw_args.b6▼
}
end
return class
end
Line 58 ⟶ 82:
local success, result = get_parameter_value(page, cfg.WPBS_redirects, 'class', options)
return success and result
end
p._quality = function(args)
local title = args.page and mw.title.new(args.page) or mw.title.getCurrentTitle()
local local_class = getclass(args, title)
local prefix, class = 'Y', local_class
if local_class=='¬' then
class = '¬'
elseif args.QUALITY_CRITERIA ~= 'custom' then -- project uses standard scale and will inherit article class if needed
local article_class = p.readarticleclass({ignore_subtemplates=true},title.prefixedText)
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({ignore_blank=true, only_subtemplates=true},title.prefixedText)
if classparam == '' then -- no class parameters defined, display as globally unassessed
prefix = 'H' -- hide quality class in project banner
end
end
elseif local_class == '' or local_class == article_class then -- local class matches article class or is blank
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
end
return (args.noprefix and '' or prefix) .. class
end
p.quality = function(frame) -- used by WPBM to check global quality and compare with local parameter
return p._quality(frame.args)
end
local importance_mask = function(raw_importance, class, scale, banner_name)
Line 279 ⟶ 335:
end
local class_mask = require('Module:Class mask' .. (sandbox or ''))._main
local class = getclass(args, current_title)
▲if args.QUALITY_SCALE=='inline' then
▲ class = raw_args.class
▲elseif args.QUALITY_SCALE=='subpage' then
▲ local custom_mask = banner_name:subPageTitle('class')
▲ if custom_mask.exists then
▲ class = frame:expandTemplate{
▲ title = custom_mask.prefixedText,
▲ args = raw_args
▲ }
▲ end
▲else
▲ local classmask_args = {
▲ FQS = args.QUALITY_SCALE=='extended' and 'yes' or 'no',
▲ [1] = raw_args.class,
▲ b1 = raw_args.b1, b2 = raw_args.b2, b3 = raw_args.b3, b4 = raw_args.b4, b5 = raw_args.b5, b6 = raw_args.b6
▲ class = class_mask(classmask_args, current_title)
▲end
local show_quality = true
if class=='¬' then
|