Module:DYK queue generator

-- this is for a proof-of-concept in User:Theleekycauldron's userspace. local Date = require('Module:Date')._Date local p = {}; local cfg = {}; local letters = "bcdefghijklmnopqrstuzwxyz";

p.main = function(frame) local now = Date('currentdate'); local result = ""; local base_queue_text = "===Queue ^d   edit  ===\n" local i=0; local queues_per_day = 1; local last_queue = ""; local breaker=false; for d=0,49 do		for n=0,queues_per_day-1 do			local oper = '^dd' local date = now+oper:gsub("%^d",d) local queue = date:text('ymd')..letters:sub(n,n) if i>7 then -- limit the number of displayed queues to 7 or necessary, whichever is larger clear_size = mw.title.makeTitle("Template","Did you know/Clear"):getContent:len queue_size = mw.title.makeTitle("User","Theleekycauldron/Projects/Did you know/Queue/" .. queue):getContent if queue_size == nil then queue_size = 0 else queue_size = queue_size:len end last_queue_size = mw.title.makeTitle("User","Theleekycauldron/Projects/Did you know/Queue/" .. last_queue):getContent if last_queue_size == nil then last_queue_size = 0 else last_queue_size = last_queue_size:len end if queue_size <= clear_size and last_queue_size <= clear_size then breaker = true; break; end end result = result .. base_queue_text:gsub("%^d",queue) .. "\n" i = i + 1; last_queue = queue end if breaker then break; end end return frame:preprocess(result); end return p;