Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
return logic to current order
+check_fallbacks
Line 115:
elseif pagetype=='disambiguation page' then
out = resolveFQSgrade('disambig')
elseif article or pagetype=='article' or pagetype=='set index article' then
if pagetype=='set index article' then
out = 'List'
Line 332:
elseif assessment_link=='no' then
assessment_link = nil
end
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 .. ' ' .. (article and 'articles' or 'pages'))
return (cat.exists and #cat:getContent()>0) and class or 'NA' -- automatically use NA for non-article pages if category does not exist
else
return class
end
end
local class = raw_args.class
Line 372 ⟶ 364:
class = p.class_mask(class, title, true, pagetype, article)
end
local category_existscheck_fallbacks = function(class, category)
if not isarticle(class) then -- checkno fallbacksfallback for non-article classes
local category_exists = function(class)
return class
local cat = mw.title.new(cfg.quality.assessment_category:format(class, assessment_cat .. ' ' .. (article and 'articles' or 'pages')))
else -- check fallbacks for non-article classes
return cat.exists and #cat:getContent()>0 -- check if category exists and is not blank
local new_class = class
end
local category_exists = function(class)
if class=='FM' and not category_exists('FM') then
local cat = mw.title.new('Category:' cfg.quality. assessment_category:format(class, .. '-Class' .. ' ' .. assessment_catcategory .. ' ' .. (article and 'articles' or 'pages')))
class = 'File' -- fall back to File-class if FM category does not exist
local return check_existscat.exists =and function#cat:getContent(class, assessment_cat)>0 -- check if category exists and is not blank
end
end
if not category_exists(class) then
if class=='FM' and not category_exists('FM') then
class = 'NA' -- automatically use NA for non-article pages if category does not exist
class new_class = 'File' -- fall back to File-class if FM category does not exist
end
if not category_exists(classnew_class) then
return new_class (cat.exists and #cat:getContent()>0) and class or= 'NA' -- automatically use NA for non-article pages if category does not exist
end
return new_class
end
end
class = check_fallbacks(class, assessment_category)
local check_redundant = function()
if raw_args.class~='' and args.QUALITY_CRITERIA~='custom' then -- banner has a non-blank class value which is ignored
Line 604 ⟶ 603:
end
if yesno(args[tf_prefix..'QUALITY']) and class then
local tf_class = check_existscheck_fallbacks(class, tf_assessment_cat)
add_category((tf_class=='' and 'Unassessed' or tf_class..'-Class') .. ' ' .. tf_assessment_cat .. ' ' .. (article and 'articles' or 'pages'))
end