Jump to content

Module:XfD old

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pppery (talk | contribs) at 00:42, 2 March 2019 (Pppery moved page Module:Sandbox/pppery/summarize page to Module:XfD summary without leaving a redirect: Moving out of sandbox). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
local tableTools = require("Module:TableTools")
local ymd = require("Module:YMD to ISO")._main
local lang = mw.getContentLanguage()
function sortkey(name1, name2)
	local key1 = ymd(mw.ustring.match(name1, "Log/(.*)"))
	local key2 = ymd(mw.ustring.match(name2, "Log/(.*)"))
	return key1 > key2
end
function p.main(frame)
	local t = frame.args.title or frame:getParent():getTitle()
	local content = mw.title.new(t .. "/Old unclosed discussions"):getContent();
	local m = mw.ustring.gmatch(content, "* %[%[(" .. t .. "/Log/[^#]*)")
	local seen = {}
	while true do
		local x = m()
		if not x then
			break
		end
		if seen[x] == nil then
			seen[x] = 0
		end
		seen[x] = seen[x] + 1
	end
	out = ""
	for k, v in tableTools.sortedPairs(seen, sortkey) do
		out = out .. "* [[" .. k .. "]] (" .. tostring(v) .. " open) \n"
	end
	return out
end
return p