-- Various hacky solutions to allow AfD and MfD to show up on [[Template:XFD Backlog]]-- AfD is easy, as [[User:Mathbot]] already summarizes the total on each daylocalp={}locallang=mw.getContentLanguage()functionp.afd(frame)localmonth=frame.args.monthlocalpatifmonth=="total"thenpat="%(([0-9]+) open"elsemonth=lang:formatDate("Y F",month)pat="%[%[Wikipedia:Articles for deletion/Log/"..month.."[^%]]*%]%] %(([0-9]+) open /"endlocalcontent=mw.title.new("Wikipedia:Articles for deletion/Old"):getContent()localcount=0fordaycountincontent:gmatch(pat)docount=count+daycountendreturncountend-- MfD is much harder, because the only list of all active MfDs is the main-- [[Wikipedia:Miscellany for deletion]] page itselffunctionp.mfd(frame)localmonth=frame.args.monthlocalcontent=mw.title.new("Wikipedia:Miscellany for deletion"):getContent()localrightmonth=truelocalpat;ifmonth~="total"thenpat=lang:formatDate("^=== ?F [0-9]*, Y ?===$",month)rightmonth=falseendlocal_,endindex=content:find("==Old business==")localcount=0forlineinmw.text.gsplit(content:sub(endindex,#content),"\n")doifline:find("{{Wikipedia:Miscellany for deletion/")andrightmonththencount=count+1elseifmonth=="total"then-- don't worry about month section headerselseifline:find(pat)thenrightmonth=trueelseifline:find("=== ?.* ?===")then-- A section header for the wrong monthifrightmonththen-- We're now looking at MfDs before the month in questionbreakend-- We still haven't reached the month in question yetendendreturncountend-- RfD is even worse, since I have to manually parse all log pages-- and "Old" discussions aren't displayed separately from "Current" onesfunctionp.rfd(frame)localmonth=frame.args.monthlocalcontent=mw.title.new("Wikipedia:Redirects for discussion"):getContent()-- First find the daily pageslocalymd=require("Module:YMD to ISO")._mainlocallang=mw.getContentLanguage()localthreshold=os.date("%F",os.time()-(86400*7))localtotal=0forlineincontent:gmatch("{{Wikipedia:Redirects for discussion/Log/.-}}")dolocaldatestamp=ymd(line:match("{{Wikipedia:Redirects for discussion/Log/(.-)}}"))ifdatestamp>=thresholdthen-- These dicussions aren't seven days old yetelseifmonth=="total"ormonth==lang:formatDate("F Y",datestamp)thenlocaldayContent=mw.title.new(line:match("{{(.*)}}")):getContent()-- unreliable but performance is importantlocal_,sectionHeads=dayContent:gsub("==== ?[^\n]- ?====","")local_,closeBoxes=dayContent:gsub("boilerplate rfd vfd xfd%-closed","")local_,relisted=dayContent:gsub("%[%[File:Symbol move vote.svg|16px|link=|alt=%]%] '''Relisted'''","")total=total+(sectionHeads-closeBoxes-relisted)-- else discussion is wrong monthendendreturntotalendreturnp