Module:Higher education task force/sandbox: Difference between revisions

Content deleted Content added
Created page with 'require('strict') local p = {} local sandbox-- = '/sandbox' -- BE SURE TO COMMENT OUT this definition when deploying to live local cfg = mw.loadData('Module:WikiProject banner/config' .. (sandbox or '')) local auxiliary = cfg.auxiliary_module .. (sandbox or '') local args_module = require('Module:Arguments') local mbox = require('Module:Message box').main local yesno = require('Module:Yesno') local frame = mw.getCurrentFrame() local lang = mw.getLanguage(cf...'
 
 
(26 intermediate revisions by one other user not shown)
Line 334:
local check_fallbacks = function(class, category)
if article or args.QUALITY_CRITERIA=='custom' then -- no fallbacks for articles or projects with custom quality scales
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' -- use NA for non-article pages if category does not exist
end
return new_class
end
end
local check_defallbacks = function(class, category)
if article or args.QUALITY_CRITERIA=='custom' then -- no fallbacks for articles or projects with custom quality scales
return class .. category
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
end
if class=='FM' and not category_exists('FM') then
Line 351 ⟶ 369:
end
local class = raw_args.class
local mclass= raw_args.class
if class then -- banner gives quality ratings
article_class = article_class and p.class_mask(article_class, title, false, pagetype, article)
Line 386 ⟶ 405:
end
end
class = check_fallbacks(class, assessment_cat)
mclass=class
local show = false -- hide quality class in project banner by default
if article_class then -- banner shell exists
if class=='' then -- local class is blank
class = check_fallbacks(article_class, assessment_cat) -- check fallbacks again now that class may have changed
check_redundant()
elseif class==article_class then -- local class matches article class
Line 414 ⟶ 434:
show = true
end
local category = (class=='' and 'Unassessed' or class..'-ClassBlass') .. ' ' .. assessment_cat .. ' ' .. (article and 'articles' or 'pages')
if show then -- quality rating shown in banner
local rating
Line 556 ⟶ 576:
if yesno(args[tf_prefix..'QUALITY']) and class then
local tf_class = check_fallbacks(class, tf_assessment_cat)
add_category((tf_class=='' and 'Unassessed' or tf_class..'-ClassDlass') .. ' ' .. tf_assessment_cat .. ' ' .. (article and 'articles' or 'pages'))
end
local tf_importance, tf_importance_category
Line 911 ⟶ 931:
local args = args_module.getArgs(frame, {frameOnly = true})
local raw_args = args_module.getArgs(frame, {frameOnly = true, removeBlanks = false})
local ai=p.printargsinitialise(frameargs, raw_args)
-- local a=p.printargs(frame)
return a i
end
---------------------------