local p= -- ultimate planned purpose is to create table rows of Refdesk questions, type, date, answerer including wikilinks in collaboration with a big templatefunction p.main(frame,input,label,desk,year,month,day,arcpage) local args=frame.args local parent=frame:getParent or local pargs=parent.args or input=input or args.input or pargs.input desk=desk or args.desk or pargs.desk local label=label or args.label or pargs.label if not label then label=desk or "unlabelled" end local date=args.date or pargs.date or "undated" if year and month and day then date="20"..year..": "..month.." "..day end arcpage=arcpage or args.arcpage or pargs.arcpage or nil local cat=args.cat or pargs.cat or "yes" if cat
local cursor, next_cursor, questioner, users, user_table, last_user; local input_length = mw.ustring.len(input); local breakpoints = ; local cut, item for cut, item in mw.ustring.gmatch(input, "\n
+%s+") do table.insert(breakpoints, cut); table.insert(breakpoints, item); end index = 1; output = ; repeat cursor = tonumber(breakpoints[index]); title = breakpoints[index + 1]; if cursor
"yes" or cat
index = index + 2; until next_cursor
function p.month(frame) local args=frame.args local parent=frame:getParent or local pargs=parent.args or local title if not input then title=mw.title.getCurrentTitle end local year=args.year or pargs.year local month=args.month or pargs.month local desk=args.desk or pargs.desk local label=args.label or pargs.label or desk local nowiki=args.nowiki or pargs.nowiki local desks= local months= local days=31 local output="" if not (desk and year and month) then -- I want to be able to plop this template empty of parameters into an archive page, even if it moves, as long as its name contains the data! local title=mw.title.getCurrentTitle local page=title.fullText if not desk then for x=1,#desks do if mw.ustring.match(page,desks[x]) then desk=desks[x]; break end end end year=year or mw.ustring.match(page,"20(%d%d)") -- This has a Y2.1k bug. Pity. if not month then for x=1,12 do if mw.ustring.match(page,months[x]) then month=months[x]; break end end end end year=tonumber(year) if month
'April' or month
'November' then days=30 end if month
math.floor(year/4) then days=29 end end for day=1,days do page='Wikipedia:Reference desk/Archives/'..desk..'/20'..year..' '..month..' '..day title=mw.title.new(page) if title then local input=title.getContent(title) if input then output=output..p.main(frame,input,label,desk,year,month,day,page) end end end output='
question\n!length\n | RefDesk\n!Category\n | Date\n!Editors'..output..'\n |
---|
<nowiki>"..output.."</nowiki>") else return output endend
return p