Module:LatestAfD

From blackwiki
Revision as of 17:55, 30 May 2017 by blackwiki>Swpb
Jump to navigation Jump to search

Implements {{LatestAfD}}, which links to the most recent AfD discussion for the specified article.



local p = {}

function p.latestafd(frame)
	local page = frame.args[1]

	base_string = "Wikipedia:Articles for deletion/" .. page
	base_title = mw.title.new(base_string)

	if not base_title.exists then
		return "Error, no AfD exists"
	else
		afd_num = 1
		latest = false
		while not latest do
			page_title = mw.title.new(base_string)
			if page_title.exists then
				return "[[" .. base_string .. "]]"
			end
		end

	end

end

return p