Hopp til innhold

Modul:FlaggIOC/sandkasse

Fra Wikipedia, den frie encyklopedi
Moduldokumentasjon

Denne modulen benyttes av {{FlaggIOC}}, {{FlaggIOClag}}, {{FlaggIOCmedaljør}} og {{FlaggIOCutøver}}.


local p = {}
 
local lang = mw.getContentLanguage()
 
function p.FlagIOC( frame )
	local ISO3 = require('Modul:Land/alfa3')
	local ISO3name = ISO3[frame.args[1]]
		
	local year_out;
	local year_module = require("Modul:FlaggIOC/year")
	local year_out = year_module.year( frame, {
		[1] = frame.args[1],
		[2] = frame.args[2],
	})
 
	local games = tostring(lang:lc(frame.args[2]))
	if games == 'sommer' then
		games_out = 'Sommer-OL'
	elseif games == 'vinter' then
		games_out = 'Vinter-OL'
	elseif games == '' then
		games_out = 'OL'
	else
		games_out = frame.args[2]
	end
	
	local link_out = ISO3name .. ' under ' .. games_out
	
	local linktext_out = ISO3name
 
 
	local number;
	if frame.args.deltakere == nil or frame.args.deltakere == '' then
		number = ''
	else
		number =  '&nbsp;<span style="font-size:90%;">(' .. frame.args.deltakere .. ')</span>'
	end
	frame.args.area = frame.args[1]
	
	local FlagModule = require('Modul:Flagg/sandkasse')
	local FlagResult = FlagModule.flag( frame, {
		[1] = ISO3name,
		[2] = year_out,
		[3] = '',
		[4] = link_out,
		[5] = linktext_out,
		[6] = '22x18px',
		[7] = '',
	})
 
	return FlagResult .. number
end

function p.FlagIOCathlete( frame )
	local ISOcode = frame.args[2]
	local ISO3 = require('Modul:Land/alfa3')
	local ISO3name = ISO3[frame.args[2]]
	
	local year_out;
	local year_module = require("Modul:FlaggIOC/year")
	local year_out = year_module.year( frame, {
		[1] = frame.args[2],
		[2] = frame.args[3],
	})
	
	local athlete = frame.args[1]
	
	local games = tostring(lang:lc(frame.args[3]))
	if games == 'sommer' then
		games_out = 'Sommer-OL'
	elseif games == 'vinter' then
		games_out = 'Vinter-OL'
	elseif games == '' then
		games_out = 'OL'
	else
		games_out = frame.args[3]
	end
	
	local FlagModule = require('Modul:Flagg/sandkasse')
	local FlagResult = FlagModule.flag( frame, {
		[1] = ISO3name,
		[2] = year_out,
		[3] = '',
		[4] = '',
		[5] = '',
		[6] = '22x18px',
		[7] = '',
		})
	
	return FlagResult .. '&nbsp;' .. athlete .. '&nbsp;([[' .. ISO3name .. ' under ' .. games_out .. '|' .. ISOcode .. ']])'
end

function p.FlagIOCteam( frame )
	local ISOcode = frame.args[1]
	local ISO3 = require('Modul:Land/alfa3')
	local ISO3name = ISO3[frame.args[1]]
	
	local year_out;
	local year_module = require("Modul:FlaggIOC/year")
	local year_out = year_module.year( frame, {
		[1] = frame.args[1],
		[2] = frame.args[2],
	})
	
	local games = tostring(lang:lc(frame.args[2]))
	if games == 'sommer' then
		games_out = 'Sommer-OL'
	elseif games == 'vinter' then
		games_out = 'Vinter-OL'
	elseif games == '' then
		games_out = 'OL'
	else
		games_out = frame.args[2]
	end
	
	local link_out = ISO3name .. ' under ' .. games_out
	local linktext_out = ISO3name
	
	local FlagModule = require('Modul:Flagg/sandkasse')
	local FlagResult = FlagModule.flag( frame, {
		[1] = ISO3name,
		[2] = year_out,
		[3] = '',
		[4] = link_out,
		[5] = linktext_out,
		[6] = '22x18px',
		[7] = '',
		})
	
	return FlagResult .. '&nbsp;(' .. ISOcode .. ')'
end
return p