Module:Dashboard entry
Appearance
This module is used to generate summaries of noticeboards displayed on Wikipedia:Dashboard.
local p = {}
--[[ Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
Therefore, we have to parse the page manuallly ]]--
function p.main(frame)
local page = frame.args[1]
local pipe = frame.args[2]
local content = mw.title.new(page):getContent()
local sections = content:gmatch("== *([^=]-) *==")
local count = 0
local output = string.format("{{Dashboard grouping|1='''[[%s|%s]]''' (<count> threads)'''<div style='font-size:85%; padding-left:1.5em;'>''Most recent:''",
page, pipe)
for sect in sections do
output = output .. string.format("\n* [[%s#%|%s]]", page, mw.uri.anchorEncode(sect), sect)
count = count + 1
if count == 3 then
output = output .. "\n</div>}}\n<div style=\"padding-left:3em;\">"
end
end
if count < 3 then
output = output .. "</div>}} {{end}}"
else
output = output .. "</div>\n{{end}}"
end
return frame:preprocess(output.replace("<count>",count))
end