Module:Affiliation

From ESU Wiki

This module pulls from a list of terms to help determine affiliation data.


local p = {}

local affiliationData = mw.loadData('Module:Affiliation/data')

local noArgMsg = '<span style="color: #ff0000">No argument provided.</span>'
local invalidArgMsg = '<span style="color: #ff0000">Invalid argument provided.</span>'

p.affiliation = function(frame)
	local args = frame:getParent().args
	if args[1] == nil then
		return noArgMsg .. '[[Category:Pages with script errors]]'
	elseif affiliationData[args[1]] == nil then
		return invalidArgMsg .. '[[Category:Pages with script errors]]'
	end
    return affiliationData[args[1]]
end

return p