มอดูล:Dashboard entry

local p = {}
local plain = require("Module:Plain text")._main
function p.main(frame) 
	local page = frame.args1
	local pipe = frame.args2
	local content = mw.title.new(page):getContent()
	-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
	-- Therefore, we have to parse the page manuallly
	local sections = content:gmatch("%{%{สภากาแฟ/อภิปรายเรื่อง| *(^=+) *)%}%}") 
	local count = 0
	local sect
	-- copy array to table so it can be iterated in reverse
	local secttable = {}
	for sect in sections do
		secttable#secttable + 1 = sect
	end
	local declutter
	if #secttable "
		end
	end
	if count }} "
	else
		output = output .. "\n"
	end
	return frame:preprocess(output)
end
function p.sectionlevel2(frame) 
	local page = frame.args1
	local pipe = frame.args2
	local content = mw.title.new(page):getContent()
	-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
	-- Therefore, we have to parse the page manuallly
	local sections = content:gmatch("\n== *(^=+) *==")
	local count = 0
	local sect
	-- copy array to table so it can be iterated in reverse
	local secttable = {}
	for sect in sections do
		secttable#secttable + 1 = sect
	end
	local declutter
	if #secttable "
		end
	end
	if count }} "
	else
		output = output .. "\n"
	end
	return frame:preprocess(output)
end
function p.village_pump(frame) 
	local page = frame.args1
	local pipe = frame.args2
	local content = mw.title.new(page):getContent()
	-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
	-- Therefore, we have to parse the page manuallly
	local sections = content:gmatch("%{%{สภากาแฟ/อภิปรายเรื่อง%|(^%}+)%}%}")
	local count = 0
	local sect
	-- copy array to table so it can be iterated in reverse
	local secttable = {}
	for sect in sections do
		secttable#secttable + 1 = sect
	end
	local declutter
	if #secttable "
		end
	end
	if count }} "
	else
		output = output .. "\n"
	end
	return frame:preprocess(output)
end
function p.rfa_nom(frame)
	local template = frame.args1 or "รายชื่อเสนอ" -- เช่น "รายชื่อเสนอ"
	local display = frame.args2 or "เสนอผู้ดูแลระบบ" -- เช่น "เสนอผู้ดูแลระบบ"
	local prefix = frame.args'prefix' or "วิกิพีเดีย:เสนอชื่อเพื่อเป็นผู้ดูแล/"
	local page = "วิกิพีเดีย:เสนอชื่อเพื่อเป็นผู้ดูแล"
	local content = mw.title.new(page):getContent() -- here we go again!
	local users = content:gmatch("\n%* *%{%{" .. template .. "%|(^%}+)%}%}") -- "* Example"
	local user 
	local usertable = {}
	for user in users do
		usertable#usertable + 1 = user
	end
	local declutter
	if #usertable "
			end
		end
	else
		output = output .. "\n* ยังไม่มีการเสนอชื่อในขณะนี้"
	end
	if count }} "
	else
		output = output .. "\n"
	end
	return frame:preprocess(output)
end
function p.rfp(frame)
	local perm = frame.args1
	local display = frame.args2 or perm
	local page = "วิกิพีเดีย:แจ้งขอสิทธิ/" .. perm
	local content = mw.title.new(page):getContent() -- here we go again and again...
	local sections = content:gmatch("\n==== *(^=+) *====")
	local count = 0
	local sect
	-- copy array to table so it can be iterated in reverse
	local secttable = {}
	for sect in sections do
		secttable#secttable + 1 = sect
	end
	local declutter
	if #secttable "
		end
	end
	if count }} "
	else
		output = output .. "\n"
	end
	return frame:preprocess(output)
end
return p