Module:Backlog

local p={}

function p.main(frame) --The first is what allows for each template to have slightly different info. --The second is the parameters used when it was called. Both are relevant. local args=frame.args local parentArgs = frame:getParent.args local count=tonumber(parentArgs[1]) local isActive if count and (mw.site.stats.pagesInCategory(mw.title.getCurrentTitle.text)<count) then isActive=false else isActive=true end --if category has elements which don't count towards the backlog, but are --technically part of the category, these will counted in arg #1,but --not in arg #2. count2=parentArgs[2] if count2 and count2~="" then count=count2 end local template="mbox" local outArgs={} local purge local ns=mw.title.getCurrentTitle.namespace if count then --only expand the purge function if it's needed purge=string.format(" (%s) ",			require("Module:Purge")._main({"recount"})) end if isActive then outArgs.demospace=parentArgs.demospace outArgs["type"]="style" outArgs.style="text-align: center;" outArgs.image="" local text if parentArgs.page then text=page elseif ns==14 then template="cmbox" text="This category" else text="This page" end local editors = args.editors text=text.." has a backlog that requires the attention of " if editors then text=text..editors else text=text.."willing editors" end text=text.."." if count then text=text.."This notice will hide itself when this category has %s items. " local fmtArg if count==1 then fmtArg="no" else fmtArg="fewer than "..count end text=string.format(text,fmtArg)..purge elseif parentArgs.auto=="yes" then text=text.." This notice will automatically hide itself when the backlog is cleared. " else text=text.."Please remove this notice if and when the backlog is cleared." end outArgs.text=text --		Basic rules of categorization:		1. Omit in User: and User talk: namespaces		2. The caller of the template can override all default categorization		  from the template.		3. If the template's caller doesn't override categorization, the 		   template has the appropriate ones		4. Module defaults exist, based on Template:Backlog if not(ns==2 or ns==3) then end else template="cmbox" if parentArgs.silent then return "" end outArgs.image="" outArgs.textstyle = "text-align: center" text="If this category has %s, it will report as a backlog." ..purge local fmtArg if count==1 then fmtArg="any items" else fmtArg=count.." items or more" end outArgs.text=string.format(text, fmtArg) end return require('Module:Message box').main(template,outArgs) end

return p;