require('strict')local p = local sandbox-- = '/sandbox'local cfg = mw.loadData('Module:WikiProject banner/config' .. (sandbox or ))local yesno = require('Module:Yesno')local lang = mw.getLanguage(cfg.language)
p.b_checklist = function(args, raw_args, class, demo, assessment_link)----------------------------- B-class checklist ---------------------------------local show_checklist = falselocal parameters_used = args.b1 or args.b2 or args.b3 or args.b4 or args.b5 or args.b6if (class
'C' or class
'CL')-- always displayed on C or B or ((class
'List') and yesno(args.B_DISPLAY_ON_START))-- show on Start/List if option selected or ((class
'Stub') and parameters_used) then-- show on Start or Stub if any parameters used show_checklist = trueendif show_checklist then local scale = args.QUALITY_CRITERIA
'u' or b
p.todo_list = function(args, frame)----------------------------- To-do list ----------------------------------------local listif args.TODO_LINK then local link = function(action) local url = mw.uri.fullUrl(args.TODO_LINK,) return mw.html.create('li'):wikitext('[' .. tostring(url) .. ' ' .. cfg.todo_list[action] .. ']') end local links = yesno(args.TODO_EDITLINKS or true, 'true') and frame:expandTemplate or list = links .. '\n' .. frame:expandTemplateelse list = ('\n' .. args.TODO_TEXT) or endlocal todo_list = mw.html.create('tr') :tag('td'):attr('colspan', '3'):css('padding', '0') :tag('table'):addClass('mw-collapsible mw-collapsed'):css('background', 'transparent'):css('color', 'var(--color-base)'):css('width', '100%') :tag('tr') :tag('th'):css('text-align', 'left'):css('padding', '0.2em 2px 0.2em 0') :cssText(args.TODO_TITLE_STYLE):wikitext((args.TODO_TITLE or cfg.todo_list.default_title) .. ':') :done:done :tag('tr') :tag('td'):css('text-align', 'left'):css('padding', '5px'):css('background-color', 'white'):css('color', 'black') :css('border', '1px solid #c0c090'):css('margin-top', '5px') :cssText(args.TODO_STYLE):wikitext(list)
allDonereturn todo_listendp.todo_list_ = function(frame) return p.todo_list(frame.args, frame)end
p.quality_importance_insection = function(args, class, importance, importance_name, tf_prefix)----------------------------- Category intersection -----------------------------local suppress = falselocal prefix = tf_prefix or if class
'NA' and (yesno(args[prefix..'QII_SUPPRESS_NA']) or yesno(args[prefix..'QII_SUPPRESS_NA_IMPORTANCE'])) then suppress = trueendif not class or not importance then suppress = trueendlocal format = args[prefix..'QII_FORMAT']:gsub('C', '_C_'):gsub('I', '_I_'):gsub('T', '_T_')if format and not suppress then local new_class if class
p.image_needed = function(args, pagetype)----------------------------- Image needed --------------------------------------local type = cfg.image_needed.default_typeif args['image-type'] then local add_article = function(word) local article = cfg.image_needed.article.consonant if cfg.image_needed.vowels[string.sub(word, 1, 1)] then article = cfg.image_needed.article.vowel end return article .. ' ' .. word .. '' end type = add_article(args['image-type'])endlocal details = if args['image-details'] then details = ' ' .. string.format(cfg.image_needed.details, args['image-details'])endlocal location = if args['image-location'] then local location_cat = mw.title.new('Category:Wikipedians in ' .. args['image-location']) if location_cat.exists then location = ' ' .. string.format(cfg.image_needed.help, '' .. location_cat.text .. '' ) endendlocal category_exists = function(category) local title = mw.title.new('Category:' .. category) if title.exists then return category endendreturn end
p.collaboration = function(args, pagetype, title)----------------------------- Collaboration -------------------------------------local image = args.COLL_IMAGE or cfg.collaboration.default_imagelocal link = '' .. (args.COLL_TEXT or cfg.collaboration.default_text) .. ''local note_args = if yesno(args['collaboration-candidate'], true) then local subpage_link = (args.COLL_LINK or ) .. '#' .. title.subjectPageTitle.text note_args.candidate = endif yesno(args['collaboration-current'], true) then note_args.current = endif yesno(args['collaboration-past'], true) then note_args.past = endreturn note_argsend
p.a_class = function(args, lang)----------------------------- A-class review ------------------------------------local status = cfg.a_class.mask[lang:lc(args['a class'])]if status
p.peer_review = function(args, title)----------------------------- Peer review ---------------------------------------local image = args.PR_IMAGE or cfg.peer_review.default_imagelocal size = args.PR_SIZE or cfg.peer_review.sizelocal link = args.PR_LINK or local pr_title = args['peer review title'] and mw.title.new(args['peer review title']) or titlelocal subpage_link = link .. '/' .. pr_title.subjectPageTitle.textlocal invalid_cat = not mw.title.new(subpage_link).exists and args.PR_INVALID_CATlocal note_args = if yesno(args['peer review'], true) then note_args.current = endif yesno(args['old peer review'], true) then note_args.past = endreturn note_args
endreturn p