Jump to content

Module:WikiProjects for deletion

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by CX Zoom (talk | contribs) at 14:47, 2 November 2024 (Case insensitive "WikiProject"). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local A = {}

function A.main( frame )
	local content = mw.title.new ("Wikipedia:Miscellany for deletion"):getContent();	-- get source code from parent MfD page
	local temp																	-- var to hold templates on MfD page
	local store = {}															-- store transclusions before final output
	
	for t in string.gmatch(content, "{{(.-)}}") do
		temp = mw.text.trim(t)													-- store content between {{}} in temp
		if string.find(temp, "[Ww][Ii][Kk][Ii][Pp][Rr][Oo][Jj][Ee][Cc][Tt]") then
			table.insert (store, "\n" .. frame:expandTemplate{ title = temp } .. "\n----");
			-- done via table.concat to parse \n as newline; what we get after concat is passed into the table "store" 
		end
	end
	
	local n = table.maxn(store)													-- # of items in table "store" = # of WP discussions
	local display = table.concat(store)											-- concat the table "store" and store it in display
	
	local number = frame.args["number"]											-- check if "number" parameter is answered
	if (number == "Yes") or (number == "yes") or (number == "y") or (number == "Y") or (number == "1") then
		return n																-- print number of WP discussions, if number is wanted
	else
		return display															-- print display, if number isn't wanted
	end
end

return A