Content deleted Content added
this should happen earlier |
use article boolean |
||
Line 103:
-- otherwise returns class parameter
end
p.class_mask = function(class, title, FQS, pagetype, article)
local resolveFQSgrade = function(class)
return FQS and lang:ucfirst(class) or 'NA'
Line 115:
elseif pagetype=='disambiguation page' then
out = resolveFQSgrade('disambig')
elseif article or pagetype=='article' or pagetype=='set index article' then
out = 'List'▼
elseif pagetype=='article' then▼
if class=='start' or class=='stub' then -- Ucfirst
out = lang:ucfirst(class)
Line 123 ⟶ 121:
out = class:upper()
elseif class=='list' or class=='sia' or class=='si' or class=='sl' then-- List
▲ out = 'List'
out = 'List'
else
Line 166:
sia = 'set index article'
})
local article = pagetype=='article' or pagetype=='set index article'
local rows, nested_ratings, task_forces, notes, categories, taskforce_categories = {}, {}, {}, {}, {}, {}
local add_category = function(category, key)
Line 173 ⟶ 174:
end
local parse_pt = function(text) -- function to replace _PAGETYPE_ with the actual page type
local ptype =
return text and text:gsub('_PAGETYPE_', ptype)
end
Line 311 ⟶ 312:
end
else -- no banner shell on page
if
add_category(cfg.banner_shell.category.no_banner_shell_articles)
elseif title.namespace==3 then --User talk namespace
Line 335 ⟶ 336:
local check_exists = function(class, assessment_cat) -- check if category exists and is not blank
if not isarticle(class) then
local cat = mw.title.new('Category:' .. class .. '-Class' .. ' ' .. assessment_cat .. ' ' .. (
return (cat.exists and #cat:getContent()>0) and class or 'NA' -- automatically use NA for non-article pages if category does not exist
else
Line 343 ⟶ 344:
local class = raw_args.class
if class then -- banner gives quality ratings
article_class = article_class and p.class_mask(article_class, title, false, pagetype, article)
local show_quality, conflict = true, false
if args.QUALITY_CRITERIA=='custom' then -- project has opted out of standard assessment scale and uses a custom mask
Line 371 ⟶ 372:
end
else
class = p.class_mask(class, title, true, pagetype, article)
end
if not isarticle(class) then -- check fallbacks for non-article classes
local category_exists = function(class)
local cat = mw.title.new(cfg.quality.assessment_category:format(class, assessment_cat .. ' ' .. (article and 'articles' or 'pages')))
return cat.exists and #cat:getContent()>0 -- check if category exists and is not blank
end
Line 384 ⟶ 385:
class = 'NA' -- automatically use NA for non-article pages if category does not exist
end
--if raw_args.class~='' and args.QUALITY_CRITERIA~='custom' then▼
local check_redundant = function()
-- add_category(cfg.banner_shell.category.redundant_class)▼
▲
--end▼
end
if article_class then -- banner shell exists
if class=='' or class==article_class
show_quality = false -- hide quality class in project banner
check_redundant()
▲ class = article_class
▲ end
elseif article_class=='' then -- local class defined and no article class defined
add_category(cfg.banner_shell.category.no_quality_rating)
Line 402 ⟶ 401:
warning = warning .. display_error(cfg.banner_shell.piqa_warning)
end
elseif
show_quality = false
check_redundant()
elseif args.QUALITY_CRITERIA~='custom' then -- article class exists and differs from local class
conflict = true
Line 409:
end
end
local category = (class=='' and 'Unassessed' or class..'-Class') .. ' ' .. assessment_cat .. ' ' .. (
if show_quality then -- quality rating shown in banner
local rating
if
rating = class=='' and cfg.quality.not_yet or cfg.quality.rated:format(class)
else
Line 545:
for _, k in ipairs(task_forces) do
local tf_prefix = 'TF_' .. k .. '_'
local tf_assessment_cat = assessment_category(
args[tf_prefix..'ASSESSMENT_CAT'], args[tf_prefix..'NAME'] )
local tf_importance
if raw_args['tf '..k..' importance'] then
Line 601 ⟶ 604:
if yesno(args[tf_prefix..'QUALITY']) and class then
local tf_class = check_exists(class, tf_assessment_cat)
add_category((tf_class=='' and 'Unassessed' or tf_class..'-Class') .. ' ' .. tf_assessment_cat .. ' ' .. (
end
if tf_importance then
|