Module:Station
Documentation for this module may be created at Module:Station/doc
p.simple = function(frame)
local code = frame.args[1] or "KCC"
local station = findStation(code)
local servedLines = getLinesForStation(code)
if not station then
return "Station " .. code .. " not found"
end
local stationName = type(station) == "table" and (station[1] or station.name) or station
-- Simple infobox with minimal formatting
local wikitext = string.format([[
{{Infobox
| name = %s Station
| station_code = %s
| image =
| caption =
]], stationName, code)
-- Add lines
local count = 0
for lineKey, lineData in pairs(servedLines) do
count = count + 1
wikitext = wikitext .. string.format("| line%d = %s\n", count, lineData.name)
end
wikitext = wikitext .. "}}"
return wikitext
end