Module:GR header
Appearance
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame,{parentOnly = true})
local sign = ''
local line = ''
local mode = {'','',0}
local name = {
args.name_el or frame:expandTemplate{title='red',args={'Greek name missing!'}},
args.name or frame:expandTemplate{title='red',args={'English name missing!'}}
}
-- Box style
if args.mode == 'AA' then sign = '0057A3;color:#FFF;text-align:left' else sign = 'FFF' end
-- Line style (field 'line_2' will reject 'TM12', because it uses inset shadows to achieve the double stripe effect)
if args.line ~= nil then line = 'border-top:'..p.line(args.line,args.name) end
if args.line_2 ~= nil and args.line_2 ~= 'TM12' then line = line..';border-bottom:'..p.line(args.line_2,args.name) end
-- Mode style
if args.mode == 'AA' then
mode = {p.mode(args.mode),'','0 0 6'}
elseif p.mode(args.mode) ~= '' then
mode = {p.mode(args.mode),p.mode(args.mode_2,'r'),6}
end
mw.log(p.mode(args.mode))
-- English name style
if name[2] == 'KAT' then
name[2] = ''
elseif name[2] == 'Athens International Airport' then
name[2] = '<br/><span style="font-weight:normal">'..name[2]..'</span>'
else
name[2] = '<br/><span style="font-size:85%">'..name[2]..'</span>'
end
return '<div style="background-color:#'..sign..';border:1px solid #A2A9B1;margin-bottom:3px"><div style="align-items:center;display:flex;padding:2px 6px;'..line..'">'..mode[1]..'<div style="margin:0px '..mode[3]..'px;width:100%">'..frame:expandTemplate{title='lang',args={'el',name[1]}}..name[2]..'</div>'..mode[2]..'</div></div>'
end
function p.line(s,n)
if s == 'AM1' then
c = '007A33'
elseif s == 'AM2' or s == 'TM1' or s == 'TM12' then
c = 'DA291C'
elseif s == 'AM3' or s == 'TM2' or s == 'TS' then
c = '10069F'
elseif s == 'AM4' then
c = 'FFA300'
elseif s == 'AS' then
if n == 'Athina' then c = '00A3E0' else c = 'FFCD00' end
elseif s == 'ASK' then
c = '00A3E0'
elseif s == 'AT' then
c = '78BE20'
else
return 'none'
end
if s == 'TM12' then
return '3px solid #'..c..';box-shadow:inset 0 3px #10069F;padding-top:5px'
else
return '6px solid #'..c
end
end
function p.mode(s,f)
if s == nil and f == 'r' then
return '<div class="nomobile noprint" style="min-width:30px;"></div>'
elseif s == 'S' then
m = {'OSE-Logo.svg','Hellenic Train'}
elseif s == 'SO' then
m = {'OSE-Logo.svg','Diakopto–Kalavryta railway'}
elseif s == 'AA' then
m = {'Airplane silhouette white.svg','Athens International Airport'}
elseif s == 'AM' then
m = {'Logo of the Athens Metro Operating Company (AMEL).svg','Athens Metro'}
elseif s == 'AS' then
m = {'Proastiakos icon (no text).svg','Athens Suburban Railway'}
elseif s == 'AT' then
m = {'Logo of the Athens Tram (icon only).svg','Athens Tram'}
elseif s == 'PS' then
m = {'Proastiakos icon (no text).svg','Patras Suburban Railway'}
elseif s == 'TS' then
m = {'Proastiakos icon (no text).svg','Thessaloniki Suburban Railway'}
else
return ''
end
return '<div class="nomobile noprint" style="min-width:30px;">[[File:'..m[1]..'|30x30px|link='..m[2]..'|'..m[2]..']]</div>'
end
return p