Module:Brand/new

From Inkipedia, the Splatoon wiki

Documentation for this module may be created at Module:Brand/new/doc

local p = {}

local specificLink	=	{
	["amiibo"]			=	"amiibo (brand)",
}

local specificFileName	=	{
	["S"]	=	{},
	["S2"]	=	{},
	["S3"]	=	{},
}

function p.requireFromModule(frame)
	return p.getBrandIcon(
		string.upper(frame.game),
		frame.name,
		frame.size or 24,
		frame.icononly
	)
end

function p.invokeFromTemplate(frame)
	return p.getBrandIcon(
		string.upper(frame:getParent().args.game),
		frame:getParent().args.name,
		frame:getParent().args.size or 24,
		frame:getParent().args.icononly
	)
end

function p.invokeFromPage(frame)
	return p.getBrandIcon(
		string.upper(frame.args.game),
		frame.args.name,
		frame.args.size or 24,
		frame.args.icononly
	)
end

function p.getBrandIcon(game, name, size, icononly)
	local fileName		=	specificFileName[game][name] or string.format("%s Brand %s.png", game, name)
	local brandLink		=	specificLink[name] or name
	local result		=	string.format("[[File:%s|%dpx|link=%s]]", fileName, size, brandLink)
	
	if not icononly then
		result	=	string.format("%s [[%s|%s]]", result, brandLink, name)
	end
	
	return result
end

return p