Módulo:Estação SuperVia
Saltar para a navegação
Saltar para a pesquisa
A documentação para este módulo pode ser criada na página Módulo:Estação SuperVia/doc
local estacaosv ={}
function estacaosv.cor( linhanome )
local source_str = linhanome
local source_str_lower = mw.ustring.lower(source_str)
local deodoro_str = mw.ustring.find( source_str_lower, 'deodoro', 1, true )
local santa_cruz_str = mw.ustring.find( source_str_lower, 'santa cruz', 1, true )
local japeri_str = mw.ustring.find( source_str_lower, 'japeri', 1, true )
local paracambi_str = mw.ustring.find( source_str_lower, 'paracambi', 1, true )
local belford_roxo_str = mw.ustring.find( source_str_lower, 'belford roxo', 1, true )
local saracuruna_str = mw.ustring.find( source_str_lower, 'saracuruna', 1, true )
local vila_inhomirim_str = mw.ustring.find( source_str_lower, 'vila inhomirim', 1, true )
local guapimirim_str = mw.ustring.find( source_str_lower, 'guapimirim', 1, true )
local teleferico_a_str = mw.ustring.find( source_str_lower, 'teleférico a', 1, true )
local color = {}
-- Parada Deodoro - Santa Cruz - Japeri - Belford Roxo - Saracuruna
if deodoro_str ~= nil and santa_cruz_str ~= nil and japeri_str ~= nil and paracambi_str == nil and belford_roxo_str ~= nil and saracuruna_str ~= nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Deodoro - Santa Cruz - Japeri
elseif deodoro_str ~= nil and santa_cruz_str ~= nil and japeri_str ~= nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Deodoro - Santa Cruz
elseif deodoro_str ~= nil and santa_cruz_str ~= nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Santa Cruz - Japeri
elseif deodoro_str == nil and santa_cruz_str ~= nil and japeri_str ~= nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Deodoro
elseif deodoro_str ~= nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#e91233' -- background
color[1] = '#FFFFFF' -- font
-- Parada Santa Cruz
elseif deodoro_str == nil and santa_cruz_str ~= nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#369f3a' -- background
color[1] = '#FFFFFF' -- font
-- Parada Japeri
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str ~= nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#0096c5' -- background
color[1] = '#FFFFFF' -- font
-- Parada Japeri - Paracambi
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str ~= nil and paracambi_str ~= nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Paracambi
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str ~= nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#8acdd5' -- background
color[1] = '#FFFFFF' -- font
-- Parada Belford Roxo - Saracuruna
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str ~= nil and saracuruna_str ~= nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#666666' -- background
color[1] = '#FFFFFF' -- font
-- Parada Belford Roxo
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str ~= nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#9b4fa7' -- background
color[1] = '#FFFFFF' -- font
-- Parada Saracuruna
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str ~= nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] = '#fc892c' -- background
color[1] = '#FFFFFF' -- font
-- Parada Saracuruna - Teleférico A
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str ~= nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str ~= nil then
color[0] ='#fc892c' -- background
color[1] ='#FFFFFF' -- font
-- Parada Teleférico A
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str == nil and teleferico_a_str ~= nil then
color[0] ='#818286' -- background
color[1] ='#FFFFFF' -- font
-- Parada Saracuruna - vila_inhomirim - guapimirim
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str ~= nil and vila_inhomirim_str ~= nil and guapimirim_str ~= nil and teleferico_a_str == nil then
color[0] ='#666666' -- background
color[1] ='#FFFFFF' -- font
-- Parada Vila Inhomirim
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str ~= nil and guapimirim_str == nil and teleferico_a_str == nil then
color[0] ='#f3a800' -- background
color[1] ='#FFFFFF' -- font
-- Parada Guapimirim
elseif deodoro_str == nil and santa_cruz_str == nil and japeri_str == nil and paracambi_str == nil and belford_roxo_str == nil and saracuruna_str == nil and vila_inhomirim_str == nil and guapimirim_str ~= nil and teleferico_a_str == nil then
color[0] ='#fbca01' -- background
color[1] ='#696969' -- font
else
color[0]= '#666666' -- background
color[1] ='#FFFFFF' -- font
end
return color
end
function estacaosv.background_color_title(linhanome)
local colorbackground = estacaosv.cor( linhanome.args[1] )
return 'background-color:' .. colorbackground[0] .. ';color:'.. colorbackground[1] .. ';'
end
function estacaosv.convertlink(linhanome)
local linhanomestring = linhanome.args[1]
local linhanomelow = mw.ustring.lower( linhanomestring )
local linhanometable = {'deodoro'; 'santa cruz'; 'japeri'; 'paracambi'; 'belford roxo'; 'saracuruna'; 'vila inhomirim'; 'guapimirim' ;'teleférico a'}
local linhanometableurl = {'Deodoro'; 'Santa Cruz'; 'Japeri'; 'Paracambi'; 'Belford Roxo'; 'Saracuruna'; 'Vila Inhomirim'; 'Guapimirim' ;'Teleférico A'}
retornaurl = '';
local cormatriz
local detect
for numerorep = 1, 15, 1 do
if linhanometable[numerorep] ~= nil then
detect = mw.ustring.find(linhanomelow, linhanometable[numerorep], 1, true )
if detect ~= nil then
cormatriz = estacaosv.cor( linhanometableurl[numerorep] )
if detect == mw.ustring.find(linhanomelow,'teleférico', 1, true ) then
retornaurl = retornaurl .."[[".. linhanometableurl[numerorep] .." da SuperVia|<span style=\"color:".. cormatriz[0] .."\">Linha " .. linhanometableurl[numerorep] .."</span>]]<br />"
else
retornaurl = retornaurl .."[[Linha ".. linhanometableurl[numerorep] .." da SuperVia|<span style=\"color:".. cormatriz[0] .."\">Linha " .. linhanometableurl[numerorep] .."</span>]]<br />"
end
end
end
end
local retornolen = mw.ustring.len(retornaurl) - 6
retornaurl = mw.ustring.sub( retornaurl, 0, retornolen )
return retornaurl
end
return estacaosv