Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
+check_fallbacks
needs to be outside this closure
Line 332:
elseif assessment_link=='no' then
assessment_link = nil
end
local category_existscheck_fallbacks = function(class, category)
if isarticle(class) then -- no fallback for article classes
return class
else -- check fallbacks for non-article classes
local new_class = class
local category_exists = function(class)
local cat = mw.title.new(cfg.quality.assessment_category:format(class, category .. ' ' .. (article and 'articles' or 'pages')))
return cat.exists and #cat:getContent()>0 -- check if category exists and is not blank
end
if class=='FM' and not category_exists('FM') then
new_class = 'File' -- fall back to File-class if FM category does not exist
end
if not category_exists(new_class) then
new_class = 'NA' -- automatically use NA for non-article pages if category does not exist
end
return new_class
end
end
local class = raw_args.class
Line 364 ⟶ 382:
class = p.class_mask(class, title, true, pagetype, article)
end
local check_fallbacksclass = functioncheck_fallbacks(class, categoryassessment_cat)
if isarticle(class) then -- no fallback for article classes
return class
else -- check fallbacks for non-article classes
local new_class = class
local category_exists = function(class)
local cat = mw.title.new(cfg.quality.assessment_category:format(class, category .. ' ' .. (article and 'articles' or 'pages')))
return cat.exists and #cat:getContent()>0 -- check if category exists and is not blank
end
if class=='FM' and not category_exists('FM') then
new_class = 'File' -- fall back to File-class if FM category does not exist
end
if not category_exists(new_class) then
new_class = '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