Module:StationInfobox: Difference between revisions
Appearance
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
| Line 25: | Line 25: | ||
local station = field.Station |
local station = field.Station |
||
local image = field.Value or nil |
|||
if field.Value ~= nil and not HF.isempty(station) then |
|||
if stations[station] ~= nil then |
if stations[station] ~= nil then |
||
output = |
output = stations[station] |
||
else |
else |
||
output = "[[File:Placeholder.png|285px]]" |
output = "[[File:Placeholder.png|285px]]" |
||
| Line 33: | Line 35: | ||
return output |
return output |
||
else |
else |
||
output = " |
if field.Value ~= nil then output = field.Value else output = "Placeholder.png" end |
||
output = "[[File:" .. output .. "|285px]]" |
|||
return output |
return output |
||
end |
end |
||
Revision as of 13:32, 26 May 2015
Documentation for this module may be created at Module:StationInfobox/doc
local Infobox = {}
local HF = require('Module:HF')
local lang = mw.language.new('en')
local stations = {
["orbis"] = "[[File:OrbisStation_001.jpg|285px]]",
["ocellus"] = "[[File:OcellusStation_001.jpg|285px]]",
["coriolis"] = "[[File:CoriolisStation_001.jpg|285px]]",
["outpost"] = "[[File:Outpost_001.jpg|285px]]",
}
function Infobox.Quantify( field, vars )
local unit = field.Unit or ''
local value = field.Value or field.Default or '?'
if HF.isempty(value) then
return '---'
else
return value .. ' ' .. unit
end
end
function Infobox.MainImage( field, vars )
local output = ''
local station = field.Station
local image = field.Value or nil
if field.Value ~= nil and not HF.isempty(station) then
if stations[station] ~= nil then
output = stations[station]
else
output = "[[File:Placeholder.png|285px]]"
end
return output
else
if field.Value ~= nil then output = field.Value else output = "Placeholder.png" end
output = "[[File:" .. output .. "|285px]]"
return output
end
end
return Infobox