require('strict')local p = local sandbox = '/sandbox'local yesno = require('Module:Yesno')
local shell = function(frame, header, content, collapsed, class) local styles = frame:extensionTag('templatestyles', ,) .. frame:extensionTag('templatestyles', ,) local content_row if content then content_row = mw.html.create('tr') :tag('td') :attr('colspan', '2') :addClass('banner-shell-inner'):addClass('outercollapse') :wikitext(content) :done end local holder = mw.html.create('table') :attr('role', 'presentation') :addClass('tmbox'):addClass('tmbox-notice'):addClass('banner-shell') :addClass(class) -- allow additional class to be specified :addClass(content and 'mw-collapsible' or nil) :addClass(collapsed and 'mw-collapsed' or nil) :node(header) :node(content_row) return styles .. tostring(holder)end
p.banner_holder = function(frame) local args = require('Module:Arguments').getArgs(frame,) local image = '' local image_cell = mw.html.create('td') :addClass('mbox-image') :wikitext(image) local text_cell = mw.html.create('td') :addClass('mbox-text'):addClass('banner-shell-header') :tag('span'):addClass('nowrap'):css('float', 'left'):wikitext(string.rep(' ', 10)):done :wikitext(args.text or 'Other talk page banners') local header = mw.html.create('tr'):node(image_cell):node(text_cell) return shell(frame, header, args[1], yesno(args.collapsed))end
local DuplicateBanners = function(text) local capture = '
([%w%s]*)' local banners = for project in text:gmatch(capture) do if banners[project]p.banner_shell = function(frame) local cfg = mw.loadData('Module:Banner shell/config' .. (sandbox or )) local args = require('Module:Arguments').getArgs(frame,) local title = args.demo_page and mw.title.new(args.demo_page) or mw.title.getCurrentTitle local pagetype = require('Module:Pagetype')._main local lang = mw.language.getContentLanguage local classmask = require('Module:WikiProject banner' .. (sandbox or )).class_mask local class = classmask(args.class or , title.talkPageTitle, false, pagetype) local demo = not yesno(args.category or true, true) or args.demo_page local out = local addCategory = function(category, sort_key) if not demo and title.isTalkPage then local category_title = mw.title.new('Category:' .. category) table.insert(out, '' .. sort_key) or ) .. '') end end if demo and not args.demo_page then pagetype = 'article' end local blp = args.blp and args.blp:lower if yesno(blp) or blp
'activepol') and yesno(args.living) then addCategory(cfg.tracking.redundant) elseif (yesno(blp)
false and args.living~=nil) or blp
'other' then table.insert(out, frame:expandTemplate ) if blp
false and yesno(args.living)
index and tonumber(index) or index --convert to number if page is numerical, otherwise loadJsonData does not work local data = mw.loadJsonData(data_page.fullText)[index] if data then local level = data.level and tostring(data.level) if level and data.topic then local link = 'Wikipedia:Vital articles/Level/' .. level if (level
'5') then link = link .. '/' .. data.topic end if data.sublist then link = link .. '/' .. data.sublist end if data.section then link = link .. '#' .. data.section end if not mw.title.new(link).exists then -- add tracking category if link does not exist addCategory(cfg.vital.attention, 'L') end vital = cfg.vital.with_level:format(link, level) else vital = cfg.vital.without_level end for _, cat in ipairs(cfg.vital.categories) do if cat:find('_CLASS') and (class
) then addCategory(cfg.vital.attention, class
nil then addCategory(cfg.vital.attention, 'V') elseif data.topic
'NA' then icon_image = cfg.icons.type[pagetype] or cfg.icons.default icon_str = pagetype
then icon_image = cfg.icons.unassessed icon_str = 'Unassessed article' text = addCategory('All unassessed articles') else icon_image = cfg.icons.quality[class] or cfg.icons.unassessed icon_str = class .. '-Class ' .. pagetype text = end local icon = string.format('', icon_image, icon_str) table.insert(text, ' ' .. cfg.rating.scale) if args[1] then table.insert(text, '
' .. cfg.project.interest .. ' ') table.insert(text, yesno(args.collapsed) and cfg.project.collapsed or cfg.project.uncollapsed) local duplicate_cat = DuplicateBanners(args[1]) if duplicate_cat and title.isTalkPage then addCategory(cfg.tracking.duplicate, duplicate_cat) end elseif not yesno(args.vital) and class~= then -- if no projects and not vital and assessed then add class super category addCategory(class .. '-Class articles') end local header = mw.html.create('tr') :tag('td') :addClass('assess') :wikitext(icon) :done :tag('td') :addClass('banner-shell-header') :css('text-align', 'left') :css('font-weight', 'normal') :wikitext(table.concat(text)) :done table.insert(out, shell(frame, header, args[1], yesno(args.collapsed), 'wpbs') ) if args.listas then table.insert(out, frame:preprocess('')) end if not demo then local tracking = require('Module:Check for unknown parameters')._check(frame:getParent.args) table.insert(out, tracking) for _, param in ipairs do -- check if each has a boolean value if yesno(args[param], 'invalid')
nil and blp~=nil and blp~='other' and blp~='activepol' then addCategory(cfg.tracking.invalid, 'Pblp') end if pagetype
then -- find pages with invalid class parameter addCategory(cfg.tracking.invalid, 'Zclass') end end return table.concat(out)end
return p