Jump to content

Module:Flag/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 19:21, 6 May 2020 (flagdeco). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.icon(frame)
	local args={}
	
	for k,v in pairs(frame:getParent().args) do
		if (v or '') ~= '' then
			args[k] = v
		end
	end
	for k,v in pairs(frame.args) do
		if (v or '') ~= '' then
			args[k] = v
		end
	end
	
	local opts = {
		unknown='{{main other|[[Category:Pages using flagicon template with unknown parameters|_VALUE_' .. frame:getParent():getTitle() .. ']]}}',
		preview='Page using [[Template:Flagicon]] with unknown parameter "_VALUE_"',
		ignoreblank='y',
		[1] = '1',
		[2] = '2',
		[3] = 'noredlink',
		[4] = 'size',
		[5] = 'variant'
		}
	
	local check = require('Module:Check for unknown parameters')._check(opts,args)
	
	args['variant'] = args[2] or args['variant']
	args[2] = args[1]
	args[1] = 'cxxlo'
	args['missingcategory'] = '[[Category:Flagicons with missing country data templates]]'
	args['noredlink'] = args['noredlink'] or 'no'
	
	return require('Module:Flagg/sandbox').luaMain(frame,args)..check
end

function p.deco(frame)
	local args={}
	
	for k,v in pairs(frame:getParent().args) do
		if (v or '') ~= '' then
			args[k] = v
		end
	end
	for k,v in pairs(frame.args) do
		if (v or '') ~= '' then
			args[k] = v
		end
	end
	
	args['variant'] = args[2] or args['variant']
	args[2] = args[1]
	args[1] = 'uxxo'
	args['missingcategory'] = '[[Category:Flagdeco with missing country data templates]]'
	args['noredlink'] = args['noredlink'] or 'no'
	
	return require('Module:Flagg/sandbox').luaMain(frame,args)
end

return p