Moduuli:Tienumero
Ulkoasu
- Tarkoitus
Tarkoitus on vähentää hitaiden toimintojen määrää Wikipediassa. Sivut, joissa on liikaa hitaita toimintoja löytyy seurantaluokasta:
- Parametrit
- numero = tienumero, aina vaadittu
- koko = "iso" -> 50 pikselin kuva, muutoin 20 pikselin
- artikkeli = kohdeartikkelin nimi johon linkitetään (jos eri kuin oletus, "tietyyppi" + <nro>)
- nolinks = true -> ei wikilinkkiä kohdeartikkeliin
- nofile = true -> ei käytetä kuvaa (vain html) tienumerolle, testaamista varten
- Käyttö
{{#invoke:Tienumero|eurooppatieartikkeli|numero={{{1}}}|artikkeli={{{2|}}}|nolinks={{{3|}}}|nofile=}}
-- tarkoitus vähentää hitaita ifexist-tarkisteluita tiedostoille:
-- käsitellään tienumerot moduulissa
--
local t = {}
-- F31, 100..999, all exist
-- F35-4, all exist
local seututiet =
{
[100] = true,
-- .. fill in rest
[999] = true,
}
-- F30, 40..99, all exist
-- F35-3, all exist
local kantatiet =
{
[40] = true,
-- .. fill in rest
[99] = true,
}
-- F29, 1..29, all exist
-- F35-3, 1..29, all exist
-- category should be up to 39 though
local valtatiet =
{
[1] = true,
-- .. fill in rest
[29] = true,
}
-- F28
-- F35-1 (yhteys)
local eurooppatiet =
{
[4] = true,
[8] = true,
[12] = true,
[18] = true,
[45] = true,
[63] = true,
[67] = true,
[75] = true,
-- huomaa, nimeäminen eri muissa maissa -> oltava eri tapa
}
-- F32 ?, 1000..9999
-- only one with this naming pattern?
local yhdystietf32 =
{
[3622] = true,
}
-- F35 sarjan kuvat
local yhdystietyhteys =
{
}
-- commonsissa vain osa (1697 yhteensä), tästä tulee pitkä lista.. paljon aukkoja
-- tarvittaisiin parempi tapa, jolla myös vältetään hidas tarkistelu
-- Category:Diagrams of connecting road number signs of Finland
local yhdystietroute =
{
[1001] = true,
[1002] = true,
[1011] = true,
[1012] = true,
[1013] = true,
[1014] = true,
[1015] = true,
[1016] = true,
[1017] = true,
[1018] = true,
[1031] = true,
[1041] = true,
[1050] = true,
[1070] = true,
[1071] = true,
[1072] = true,
[1073] = true,
[1074] = true,
[1075] = true,
[1081] = true,
[1090] = true,
[1091] = true,
[1101] = true,
[1102] = true,
[1103] = true,
[1104] = true,
[1121] = true,
[1125] = true,
[1130] = true,
[1131] = true,
[1141] = true,
[1142] = true,
[1161] = true,
[1181] = true,
[1182] = true,
[1183] = true,
[1184] = true,
[1185] = true,
[1186] = true,
[1191] = true,
[1211] = true,
[1212] = true,
[1213] = true,
[1214] = true,
[1215] = true,
[1221] = true,
[1222] = true,
[1223] = true,
[1224] = true,
[1241] = true,
[1251] = true,
[1252] = true,
[1253] = true,
[1261] = true,
[1270] = true,
[1271] = true,
[1272] = true,
[1280] = true,
[1281] = true,
[1282] = true,
[1672] = true,
--[2271] = true, -- nimeäminen poikkeaa
--[3622] = true, -- nimeäminen poikkeaa
--[3623] = true, -- nimeäminen poikkeaa
[9710] = true,
[9711] = true,
}
-- jos jostain syystä (debuggaus) halutaan taulukko kuvan sijaan
local function isnofile(frame)
local nofile = frame.args.nofile or "";
if (nofile ~= "") then
if (nofile == "1") then
return true
end
end
return false
end
-- mikäli kolmas parametri == "1" -> ei linkkiä artikkeliin
local function isnolinks(frame)
local nolinks = frame.args.nolinks or "";
if (nolinks ~= "") then
if (nolinks == "1") then
return true
end
end
return false
end
-- artikkelin nimi johon linkitetään:
-- jos on annettu artikkelin nimi linkitetään siihen,
-- muutoin tuotetaan linkki automaattisesti tienumeron ja tyypin mukaan
local function kohdeartikkeli(frame)
local artikkeli = frame.args.artikkeli or "";
return artikkeli
end
local function tienro(frame)
local numero = frame.args.numero or "";
-- Mikäli ei ole parametria -> ei voida palauttaa mitään
if numero == "" then
return nil
end
-- Mikäli ei ole selkeä numero -> ei tuettu
local nro = tonumber(numero)
if nro == nil then
return nil
end
return nro
end
local function tekstikoko(frame)
local koko = frame.args.koko or "";
-- jos ei ole määritelty isoksi, käytetään pientä kuvakokoa
if koko ~= "iso" then
return 20
end
-- isompi kuvakoko
return 50
end
-- koko on yleensä joko 20 tai 50 pikseliä näissä
local function tiedostolinkkijakohde(nimi, koko, kohde)
if (kohde) then
return "[[File:" .. nimi .."|x".. tostring(koko) .."px|alt=|link=".. kohde .."]] "
end
return "[[File:" .. nimi .."|x".. tostring(koko) .."px|alt=|link=]] "
end
-- expensive, see if we can avoid this
--
-- note: result is not reliable? does not detect if articles do exist?
-- missing article links in some cases (do we need them?)
--
local function isarticleexisting(article)
-- turn off the check for now:
-- poistetaan tarkistus käytöstä toistaiseksi: yhä liian hidas
if true then
return false
end
if (article == nil) then
-- not valid name -> does not exist
return false
end
if (article == "") then
-- not valid name -> does not exist
return false
end
-- should be in main namespace if existing
-- note: is there mw.Title:exists(article) ?
local tmp = mw.title.new(article, '')
if (tmp == nil) then
return false
end
--return tmp.exist
return tmp.exists
end
local function seututiehtml(nro)
return '<table style="background-color: solid white; padding: 0; float: left; margin-left: 0.3em; margin-right: 0.3em;" cellspacing="1">'
.. '<tr><td style=" border-radius: 0.2em; -webkit-border-radius: 0.2em; -moz-border-radius: 0.2em; padding: 0.25em 0.25em 0.2em 0.25em; border: 0.1em solid black; color: black; font-weight: bold; font-size: x-large; background: white; text-align: center; font-family: Helvetica, Arial, sans-serif; letter-spacing: 0;">'
.. nro .. '</td></tr></table>'
end
local function seututiehtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#000000;">' .. nro .. '</span>]]'
else
text = '<span style="color:#000000;">' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; background-color:#eee; padding-left:1ex; padding-right:1ex; border:1px solid #000;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function seututieyhteyshtml(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#000000;">' .. nro .. '</span>]]'
else
text = '<span style="color:#000000;">' .. nro ..'</span>'
end
return '<span style="background-color:#eeeeee; padding-left:1ex; padding-right:1ex; border:2px #000000 dotted;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function kantatiehtml(nro)
return '<table style="background-color: #FCD116; padding: 0; float: left; margin-left: 0.3em; margin-right: 0.3em;" cellspacing="1">'
.. '<tr><td style=" border-radius: 0.2em; -webkit-border-radius: 0.2em; -moz-border-radius: 0.2em; padding: 0.25em 0.25em 0.2em 0.25em; border: 0.1em solid black; color: black; font-weight: bold; font-size: x-large; background: #FCD116; text-align: center; font-family: Helvetica, Arial, sans-serif; letter-spacing: 0;">'
.. nro .. '</td></tr></table>'
end
local function kantatiehtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#000000;">' .. nro .. '</span>]]'
else
text = '<span style="color:#000000;">' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; background-color:#FCD116; padding-left:1ex; padding-right:1ex; border:1px solid #000;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function kantatieyhteyshtml(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#000000;">' .. nro .. '</span>]]'
else
text = '<span style="color:#000000;">' .. nro ..'</span>'
end
return '<span style="background-color:#FCD116; padding-left:1ex; padding-right:1ex; border:2px #000000 dotted;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function valtatiehtml(nro)
return '<table style="background-color: #E8112D; padding: 0; float: left; margin-left: 0.3em; margin-right: 0.5em;" cellspacing="1"><tr>'
.. '<td style=" border-radius: 0.2em; -webkit-border-radius: 0.2em; -moz-border-radius: 0.2em; padding: 0.25em 0.25em 0.2em 0.25em; border: 0.1em solid white; color: white; font-weight: bold; font-size: x-large; background: #E8112D; text-align: center; font-family: Helvetica, Arial, sans-serif; letter-spacing: 0;">'
.. nro .. '</td></tr></table>'
end
local function valtatiehtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; background-color:#E8112D; padding-left:1ex; padding-right:1ex; border:1px solid #ddd;'
.. 'font-size:95%; font-weight: bold; ">' .. text ..'</span>'
end
local function valtatieyhteyshtml(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">' .. nro ..'</span>'
end
return '<span style="background-color:#E8112D; padding-left:1ex; padding-right:1ex; border:2px #dddddd dotted;'
.. 'font-size:95%; font-weight: bold; ">' .. text ..'</span>'
end
local function eurooppatiehtml(nro)
return '<table style="background-color: #00997C; padding: 0; float: left; margin-left: 0.3em; margin-right: 0.5em;" cellspacing="1">'
.. '<tr><td style=" border-radius: 0.2em; -webkit-border-radius: 0.2em; -moz-border-radius: 0.2em; padding: 0.25em 0.25em 0.2em 0.25em; border: 0.1em solid white; color: white; font-weight: bold; font-size: x-large; background: #00997C; text-align: center; font-family: Helvetica, Arial, sans-serif; letter-spacing: 0;">'
.. 'E ' .. nro .. '</td></tr></table>'
end
local function eurooppatiehtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">E ' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">E ' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; background-color:#00997C; padding-left:1ex; padding-right:1ex; border:1px solid #dddddd;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function eurooppatieyhteyshtml(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">E ' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">E ' .. nro ..'</span>'
end
return '<span style=" background-color:#00997C; padding-left:1ex; padding-right:1ex; border:2px dotted #dddddd;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function yhdystiehtml(nro)
return '<table style="background-color: blue; padding: 0; float: left; margin-left: 0.3em; margin-right: 0.5em;" cellspacing="1">'
.. '<tr><td style=" border-radius: 0.2em; padding: 0.25em 0.25em 0.2em 0.25em; border: 0.1em solid white; color: white; font-weight: bold; font-size: x-large; background: blue; text-align: center; font-family: Helvetica, Arial, sans-serif; letter-spacing: 0;">'
.. nro .. '</td></tr></table>'
end
local function yhdystiehtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; background-color:#0072C6; color: #fff;-webkit-border-radius: 4px; -moz-border-radius: 4px;'
.. 'padding-left:1ex; padding-right:1ex; border:1px solid #ddd;'
..'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
local function yhdystieyhteyshtml(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">' .. nro ..'</span>'
end
return '<span style="background-color:#0072C6; color:#ffffff; padding-left:1ex; padding-right:1ex; border:2px #ddd dotted;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
-- tienumero vihreä, jotenkin eri tapaus ilmeisesti
--
local function tienumerogreenhtmlartikkeli(nro, artikkeli, nolink)
local text;
if (article and nolink == false) then
text = '[[' .. article .. '|<span style="color:#ffffff;">' .. nro .. '</span>]]'
else
text = '<span style="color:#ffffff;">' .. nro ..'</span>'
end
return '<span style="border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; background-color:#00997C; padding-left:1ex; padding-right:1ex; border:1px solid #ddd;'
.. 'font-size:95%; font-weight: bold;">' .. text ..'</span>'
end
-- mallinemuutoksen helpottamiseen, pelkkä numero parametrina
-- valtateille yms. omat metodit
-- numerot 100–999
function t.seututie(frame)
local nro = tienro(frame)
if nro ~= nil then
if (nro >= 100 and nro <= 999) then
local tiedosto = "Finland road sign F31-" .. tostring(nro) .. ".svg"
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), nil)
end
-- kaikki tällä välillä ovat olemassa, yhteensopivuuden vuoksi kuitenkin varalta..
return seututiehtml(nro)
else
-- kuvat, jotka eivät ole suomalaisten teiden?
return seututiehtml(frame.args.numero)
end
end
-- pienempi, linkitys artikkeliin
-- 1 = numero, 2 = artikkeli, 3 = 1 jos ei linkitystä
function t.seututieartikkeli(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Seututie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 100 and nro <= 999 and nofile == false) then
local tiedosto = "Finland road sign F31-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Seututie")
end
end
if (existing == true) then
return seututiehtmlartikkeli(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return seututiehtmlartikkeli(nro, "Seututie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Seututie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return seututiehtmlartikkeli(frame.args.numero, article, nolinks)
end
end
-- numerot 40-99
function t.kantatie(frame)
local nro = tienro(frame)
if nro ~= nil then
if (nro >= 40 and nro <= 99) then
local tiedosto = "Finland road sign F30-" .. tostring(nro) .. ".svg"
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), nil)
end
return kantatiehtml(nro)
else
-- kuvat, jotka eivät ole suomalaisten teiden?
return kantatiehtml(frame.args.numero)
end
end
-- pienempi, linkitys artikkeliin
-- 1 = numero, 2 = artikkeli, 3 = 1 jos ei linkitystä
function t.kantatieartikkeli(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Kantatie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 40 and nro <= 99 and nofile == false) then
local tiedosto = "Finland road sign F30-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Kantatie")
end
end
if (existing == true) then
return kantatiehtmlartikkeli(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return kantatiehtmlartikkeli(nro, "Kantatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Kantatie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return kantatiehtmlartikkeli(frame.args.numero, article, nolinks)
end
end
-- numerot 1–39
function t.valtatie(frame)
local nro = tienro(frame)
if nro ~= nil then
-- range is upto 39, but 29 exist
--if (nro >= 1 and nro <= 39) then
if (nro >= 1 and nro <= 29) then
local tiedosto = "Finland road sign F29-" .. tostring(nro) .. ".svg"
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), nil)
end
return valtatiehtml(nro)
else
-- kuvat, jotka eivät ole suomalaisten teiden?
return valtatiehtml(frame.args.numero)
end
end
-- pienempi, linkitys artikkeliin
-- 1 = numero, 2 = artikkeli, 3 = 1 jos ei linkitystä
function t.valtatieartikkeli(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Valtatie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 1 and nro <= 29 and nofile == false) then
local tiedosto = "Finland road sign F29-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Valtatie")
end
end
if (existing == true) then
return valtatiehtmlartikkeli(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return valtatiehtmlartikkeli(nro, "Valtatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Valtatie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return valtatiehtmlartikkeli(frame.args.numero, article, nolinks)
end
end
function t.eurooppatie(frame)
local nro = tienro(frame)
if nro ~= nil then
-- not continuous range in countries
local l = eurooppatiet[ nro ]
if l then
local tiedosto = "Finland road sign F28-" .. tostring(nro) .. ".svg"
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), nil)
end
return eurooppatiehtml(nro)
else
-- kuvat, jotka eivät ole suomalaisten teiden?
return eurooppatiehtml(frame.args.numero)
end
end
-- pienempi, linkitys artikkeliin
-- 1 = numero, 2 = artikkeli, 3 = 1 jos ei linkitystä
function t.eurooppatieartikkeli(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Eurooppatie E" .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
-- not continuous range in countries
local l = eurooppatiet[ nro ]
if l then
local tiedosto = "Finland road sign F28-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Eurooppatie")
end
end
if (existing == true) then
return eurooppatiehtmlartikkeli(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return eurooppatiehtmlartikkeli(nro, "Eurooppatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Eurooppatie E" .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return eurooppatiehtmlartikkeli(frame.args.numero, article, nolinks)
end
end
-- mallinemuutoksen helpottamiseen, pelkkä numero parametrina
-- valtateille yms. omat metodit
-- numerot 1000–9999
function t.yhdystie(frame)
local nro = tienro(frame)
if nro ~= nil then
-- vain html tässä tapauksessa
return yhdystiehtml(nro)
else
-- kuvat, jotka eivät ole suomalaisten teiden? (tekstiä numeron lisäksi?)
return yhdystiehtml(frame.args.numero)
end
end
-- range 1000..9999, > 10000 ?
function t.yhdystieartikkeli(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- jos ei kuvaa
if nro ~= nil then
local article = kohdeartikkeli(frame) or "Yhdystie " .. tostring(nro)
-- and nofile == false
local existing = isarticleexisting(article)
-- not continuous range: missing files
local l = yhdystietroute[ nro ]
if l then
local tiedosto = "Route ".. nro .."-FIN.png"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, tekstikoko(frame), "Yhdystie")
end
end
if (existing == true) then
return yhdystiehtmlartikkeli(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return yhdystiehtmlartikkeli(nro, "Yhdystie", nolinks)
end
else
-- linkitys artikkeliin
local article = kohdeartikkeli(frame) or "Yhdystie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return yhdystiehtmlartikkeli(frame.args.numero, article, nolinks)
end
end
-- tämäkin vielä: ei kuvaa, pelkkä html
-- yleensä tekstiä numeron sijaan
function t.tienumerogreen(frame)
--local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
-- jos kohde on annettu, oleta että se on olemassa
local article = kohdeartikkeli(frame)
if (article) then
return tienumerogreenhtmlartikkeli(frame.args.numero, article, nolinks)
end
-- muutoin, tarkista onko olemassa
article = "Valtatie " .. frame.args.numero
if (nolinks == false) then
-- jos linkkejä ei ole kytketty pois, tarkista onko olemassa
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
end
return tienumerogreenhtmlartikkeli(frame.args.numero, article, nolinks)
end
-- ------------ tieyhteysmallineet
-- Finland road sign F35-4-{{{1}}}.svg
function t.seututieyhteys(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Seututie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 100 and nro <= 999 and nofile == false) then
local tiedosto = "Finland road sign F35-4-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Seututie")
end
end
if (existing == true) then
return seututieyhteyshtml(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return seututieyhteyshtml(nro, "Seututie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Seututie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return seututieyhteyshtml(frame.args.numero, article, nolinks)
end
end
-- Finland road sign F35-3-{{{1}}}.svg
function t.kantatieyhteys(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Kantatie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 40 and nro <= 99 and nofile == false) then
local tiedosto = "Finland road sign F35-3-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Kantatie")
end
end
if (existing == true) then
return kantatieyhteyshtml(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return kantatieyhteyshtml(nro, "Kantatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Kantatie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return kantatieyhteyshtml(frame.args.numero, article, nolinks)
end
end
-- Finland road sign F35-2-{{{1}}}.svg
function t.valtatieyhteys(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Valtatie " .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
if (nro >= 1 and nro <= 29 and nofile == false) then
local tiedosto = "Finland road sign F35-2-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Valtatie")
end
end
if (existing == true) then
return valtatieyhteyshtml(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return valtatieyhteyshtml(nro, "Valtatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Valtatie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return valtatieyhteyshtml(frame.args.numero, article, nolinks)
end
end
-- Finland road sign F35-1-{{{1}}}.svg
function t.eurooppatieyhteys(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
local nofile = isnofile(frame) -- debugflag
if nro ~= nil then
-- jos on annettu kohdeartikkelin nimi, käytetään sitä;
-- muutoin käytetään tietyypin ja numeron mukaista kohdetta
local article = kohdeartikkeli(frame) or "Eurooppatie E" .. tostring(nro)
-- jos tiekohtainen artikkeli on olemassa:
-- näytä kuva ja linkitä sen artikkeliin
-- jos ei ole artikkelia:
-- näytä kuva ja linkitä yleisartikkeliin
-- jos ei ole kuvaa: html-esitys
local existing = isarticleexisting(article)
local l = eurooppatiet[ nro ]
if l then
local tiedosto = "Finland road sign F35-1-" .. tostring(nro) .. ".svg"
if (existing == true) then
return tiedostolinkkijakohde(tiedosto, 20, article)
else
-- tietyypin yhteinen artikkeli
return tiedostolinkkijakohde(tiedosto, 20, "Eurooppatie")
end
end
if (existing == true) then
return eurooppatieyhteyshtml(nro, article, nolinks)
else
-- tietyypin yhteinen artikkeli
return eurooppatieyhteyshtml(nro, "Eurooppatie", nolinks)
end
else
-- kuvat, jotka eivät ole suomalaisten teiden? voi olla kirjaimia mukana?
local article = kohdeartikkeli(frame) or "Eurooppatie E" .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return eurooppatieyhteyshtml(frame.args.numero, article, nolinks)
end
end
-- ei kuvaa, vain html
function t.yhdystieyhteys(frame)
local nro = tienro(frame)
local nolinks = isnolinks(frame) -- jos ei käytetä linkkejä
--local nofile = isnofile(frame) -- jos ei kuvaa
if nro ~= nil then
local article = kohdeartikkeli(frame) or "Yhdystie " .. tostring(nro)
local existing = false
if (nolinks == false) then
existing = isarticleexisting(article)
end
if (existing == false and nolinks == false) then
-- tietyypin yhteinen artikkeli
article = "Yhdystie"
end
return yhdystieyhteyshtml(nro, article, nolinks)
else
-- linkitys artikkeliin
local article = kohdeartikkeli(frame) or "Yhdystie " .. frame.args.numero
local existing = isarticleexisting(article)
if (existing == false) then
nolinks = true
end
return yhdystieyhteyshtml(frame.args.numero, article, nolinks)
end
end
return t;