Modul:Vasúti szolgáltatás ikon

A Wikipédiából, a szabad enciklopédiából

Vasúti szolgáltatás ikon[mi ez?] • [dokumentáció: mutat, szerkeszt] • [tesztek: létrehozás]

local p = {}
local getArgs = require('Modul:Arguments').getArgs

local function getIcon(icon)
	if (icon=='rjx' or icon=='railjet xpress') then
		return 'Railjet Xpress Hungary.svg'
	elseif (icon=='ec' or icon=='eurocity') then
		return 'EuroCity Hungary.svg'
	elseif (icon=='en' or icon=='euronight') then
		return 'EuroNight Hungary.svg'
	elseif (icon=='ic' or icon=='intercity') then
		return 'InterCity Hungary.svg'
	elseif (icon=='ex' or icon=='expressz' or icon=='expresszvonat') then
		return 'Expresszvonat Hungary.svg'
	elseif (icon=='gy' or icon=='gyors' or icon=='gyorsvonat') then
		return 'Gyorsvonat Hungary.svg'
	elseif (icon=='s' or icon=='sebes' or icon=='sebesvonat') then
		return 'Sebesvonat Hungary.svg'
	elseif (icon=='ir' or icon=='interrégió' or icon=='interregio') then
		return 'InterRégió Hungary.svg'
	else
		return 'Személyvonat Hungary.svg'
	end
end

local function numStyle(icon)
	if (icon=='rjx' or icon=='railjet xpress') then
		return ' style="font-weight:bold;"'
	elseif (icon=='ec' or icon=='eurocity') then
		return ' style="font-weight:bold;"'
	elseif (icon=='en' or icon=='euronight') then
		return ' style="font-weight:bold;"'
	elseif (icon=='ic' or icon=='intercity') then
		return ' style="font-weight:bold;"'
	elseif (icon=='gy' or icon=='gyors' or icon=='gyorsvonat') then
		return ' style="font-weight:bold;"'
	elseif (icon=='s' or icon=='sebes' or icon=='sebesvonat') then
		return ' style="font-weight:bold;"'
	else
		return ''
	end
end

local function nameStyle(icon)
	if (icon=='rjx' or icon=='railjet xpress') then
		return ' style="color:#cc3333; font-weight:bold; font-style:italic;"'
	elseif (icon=='ec' or icon=='eurocity') then
		return ' style="color:#0000ff; font-weight:bold; font-style:italic;"'
	elseif (icon=='en' or icon=='euronight') then
		return ' style="color:#0000ff; font-weight:bold; font-style:italic;"'
	elseif (icon=='ic' or icon=='intercity') then
		return ' style="color:#0000ff; font-weight:bold; font-style:italic;"'
	elseif (icon=='ex' or icon=='expressz' or icon=='expresszvonat') then
		return ' style="color:#ff0000; font-style:italic;"'
	elseif (icon=='gy' or icon=='gyors' or icon=='gyorsvonat') then
		return ' style="color:#ff0000; font-weight:bold; font-style:italic;"'
	elseif (icon=='s' or icon=='sebes' or icon=='sebesvonat') then
		return ' style="color:#008000; font-weight:bold; font-style:italic;"'
	elseif (icon=='ir' or icon=='interrégió' or icon=='interregio') then
		return ' style="color:#008000; font-style:italic;"'
	else
		return ''
	end
end

function p.ikon(frame)
	local args = getArgs(frame, {removeBlanks = false})
	local line
	line=string.format('[[Fájl:%s|x12px]]', getIcon(string.lower(args[1])))
	if args[3] ~= '' and args[3] ~= nil then
    line=string.format('%s&nbsp;<span%s>%s</span>', line, numStyle(string.lower(args[1])), args[3])
	end
	if args[2] ~= '' and args[2] ~= nil then
    	if args['link'] then
        	line=string.format('%s&nbsp;[[%s|<span%s>%s</span>]]', line, args['link'], nameStyle(string.lower(args[1])), args[2])
    	else
        	line=string.format('%s&nbsp;<span%s>%s</span>', line, nameStyle(string.lower(args[1])), args[2])
    	end
	end
	return line
end

return p