Module:Adjacent stations/Metro Trains Melbourne
Appearance
This is a data module for Module:Adjacent stations. It supports services operated by Metro Trains Melbourne.
| This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
Line name and colours
Metropolitan train lines
| Line | Keys | Color | Hex color | Icon |
|---|---|---|---|---|
| Alamein line | Alamein |
152C6B |
| |
| Belgrave line | Belgrave |
152C6B |
| |
| Craigieburn line | Craigieburn |
FFBE00 |
| |
| Cranbourne line | Cranbourne |
279FD5 |
| |
| Flemington Racecourse line | Flemington Racecourse or Flemington |
95979A |
| |
| Frankston line | Frankston |
028430 |
| |
| Glen Waverley line | Glen Waverley |
152C6B |
| |
| Hurstbridge line | Hurstbridge |
BE1014 |
| |
| Lilydale line | Lilydale |
152C6B |
| |
| Mernda line | Mernda |
BE1014 |
| |
| Pakenham line | Pakenham |
279FD5 |
| |
| Sandringham line | Sandringham |
F178AF |
| |
| Stony Point line | Stony Point |
028430 |
| |
| Sunbury line | Sunbury |
279FD5 |
| |
| Upfield line | Upfield |
FFBE00 |
| |
| Werribee line | Werribee |
F178AF |
| |
| Williamstown line | Williamstown |
F178AF |
|
Planning or under construction lines
| Line | Keys | Color | Hex color | Icon |
|---|---|---|---|---|
| Airport line | Airport or Melbourne Airport |
279FD5 |
| |
| Melton line | Melton |
279FD5 |
| |
| Suburban Rail Loop | Suburban Rail Loop |
008746 |
|
Title bar line colours
A title bar is automatically generated based on the line(s) serving the station using Metro and V/Line colours when this module is defined for use in Template:Infobox station. To specify the served line(s), pass a comma-separated list into |style2=.
Each recognised line name displays an equal-width colour segment across the bar, ordered in sequence from left to right as with the input. If any line name is not recognised, the entire bar falls back to default blue background styling.
Example
Canterbury |
|---|
{{Infobox station
| name = Canterbury
| type = [[Public Transport Victoria|PTV]] [[commuter rail]] station
| style = Metro Trains Melbourne
| style2 = Lilydale
}}
Sunshine |
|---|
{{Infobox station
| name = Sunshine
| type = [[Public Transport Victoria|PTV]] [[Commuter rail|commuter]] and [[regional]] rail station
| style = Metro Trains Melbourne
| style2 = Sunbury, V/Line
}}
Richmond |
|---|
{{Infobox station
| name = Richmond
| type = [[Public Transport Victoria|PTV]] [[Commuter rail|commuter]] and [[regional]] rail station
| style = Metro Trains Melbourne
| style2 = Lilydale, Frankston, Sandringham, V/Line
}}
local melbourne = "%1 railway station, Melbourne"
local c = {
Airport = "279FD5",
Alamein = "152C6B",
Belgrave = "152C6B",
Craigieburn = "FFBE00",
Cranbourne = "279FD5",
Flemington = "95979A",
Frankston = "028430",
GlenWaverley = "152C6B",
Hurstbridge = "BE1014",
Lilydale = "152C6B",
Mernda = "BE1014",
Pakenham = "279FD5",
Sandringham = "F178AF",
StonyPoint = "028430",
SuburbanRailLoop = "008746",
Sunbury = "279FD5",
Upfield = "FFBE00",
Werribee = "F178AF",
Williamstown = "F178AF",
VLine = "8F1A95",
wht = "FFFFFF",
blk = "000000",
Disused = "999933",
}
-- Draw top colour bar
local function topBars(barTable)
local segments, pos = {}, 0
local width = 100 / #barTable
for i, colour in ipairs(barTable) do
local start = pos
local stop = (i == #barTable) and 100 or (pos + width)
segments[#segments+1] = "#" .. colour .. " " .. start .. "% " .. stop .. "%"
pos = stop
end
return "background-image:linear-gradient(to right," .. table.concat(segments, ",") .. "); background-size:100% 7px; background-position:top; background-repeat:no-repeat; background-origin:border-box; background-color: white; font-size: 160%; color: black; font-family:sans-serif; text-align:center; padding: 0.45em; padding-top: calc(0.45em + 7px); white-space: nowrap; margin: 0.25em;"
end
-- Convert style2 input to draw top bar
local function styleFromNames(styleText)
local default = "background-color: #0072CE; font-size: 160%; color: white; font-family:sans-serif; text-align:center; padding: 0.45em; white-space: nowrap; margin: 0.25em;"
if not styleText or styleText == "" then return default end
local cols = {}
for part in styleText:gmatch("[^,]+") do
local key = (part or ""):gsub("[^%w]", "")
local hex = c[key]
if not hex then return default end
cols[#cols+1] = hex
end
return topBars(cols)
end
local p = {
["system title"] = "[[Metro Trains Melbourne|Metro Trains]]",
["system icon"] = "[[File:Melbourne_train_logo.svg|18px|link=Railways in Melbourne|alt=Railways in Melbourne]]",
["system color"] = "0072ce",
["name format"] = setmetatable({
["City Loop station"] = topBars({
c.Mernda,
c.Frankston,
c.Craigieburn,
c.Lilydale
}),
}, {
__index = function(_, key)
return styleFromNames(key)
end
}),
["header background color"] = "E4E4E4",
["header text color"] = "000000",
["station format"] = {
"%1 railway station",
["City Loop"] = "[[City Loop]]",
["FS or P"] = "[[Flinders Street railway station|Flinders Street]] or [[Parliament railway station|Parliament]]",
["SC or F"] = "[[Southern Cross railway station|Southern Cross]] or [[Flagstaff railway station|Flagstaff]]",
["S via FS"] = "[[Sandringham railway station|Sandringham]] via [[Flinders Street railway station|Flinders Street]]",
["W via FS"] = "[[Laverton railway station, Melbourne|Laverton]], [[Werribee railway station|Werribee]] or [[Williamstown railway station|Williamstown]] via [[Flinders Street railway station|Flinders Street]]",
["EC via M"] = "[[Cranbourne railway station|Cranbourne]] or [[East Pakenham railway station|East Pakenham]] via [[Metro Tunnel]]",
["S via M"] = "[[Watergardens railway station|Watergardens]] or [[Sunbury railway station, Melbourne|Sunbury]] via [[Metro Tunnel]]",
["FS via CL"] = "[[Flinders Street railway station|Flinders Street]] via [[City Loop]]",
["F via FS"] = "[[Frankston railway station|Frankston]] via [[Flinders Street railway station|Flinders Street]]",
["Albion"] = melbourne,
["Armadale"] = melbourne,
["Arden"] = melbourne,
["Ashburton"] = melbourne,
["Auburn"] = melbourne,
["Balaclava"] = melbourne,
["Bayswater"] = melbourne,
["Beaconsfield"] = melbourne,
["Bell"] = melbourne,
["Berwick"] = melbourne,
["Blackburn"] = melbourne,
["Box Hill"] = melbourne,
["Broadmeadows"] = melbourne,
["Brunswick"] = melbourne,
["Burwood"] = melbourne,
["Burwood (SRL)"] = "Burwood SRL station",
["Camberwell"] = melbourne,
["Canterbury"] = melbourne,
["Chatham"] = melbourne,
["Chelsea"] = melbourne,
["Cheltenham"] = melbourne,
["Clayton"] = melbourne,
["Clyde"] = "Clyde railway station, Victoria",
["Croydon"] = melbourne,
["East Richmond"] = melbourne,
["Eltham"] = melbourne,
["Epping"] = melbourne,
["Fairfield"] = melbourne,
["Hampton"] = melbourne,
["Hastings"] = melbourne,
["Hawthorn"] = melbourne,
["Ivanhoe"] = melbourne,
["Kensington"] = melbourne,
["Laverton"] = melbourne,
["Malvern"] = melbourne,
["Melton"] = melbourne,
["Mitcham"] = melbourne,
["Montmorency"] = melbourne,
["Newmarket"] = melbourne,
["Newport"] = melbourne,
["Oak Park"] = melbourne,
["Paisley"] = melbourne,
["Preston"] = melbourne,
["Richmond"] = melbourne,
["Ringwood"] = melbourne,
["Sandown Park"] = melbourne,
["Seaford"] = melbourne,
["Showgrounds"] = melbourne,
["St Albans"] = melbourne,
["Sunbury"] = melbourne,
["Thomastown"] = melbourne,
["Thornbury"] = melbourne,
["Town Hall"] = melbourne,
["Union"] = melbourne,
["Upwey"] = melbourne,
["Victoria Park"] = melbourne,
["Windsor"] = melbourne,
},
["lines"] = {
["City Circle"] = {
["title"] = "[[City Loop|City Circle]]",
["color"] = "000000",
["left terminus"] = "",
["right terminus"] = "",
["circular"] = true
},
["Alamein"] = {
["title"] = "[[Alamein line]]",
["color"] = c.Alamein,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Alamein",
["types"] = {
["shuttle"] = {
["title"] = "",
["left terminus"] = "Camberwell",
["note-mid"] = "Shuttle service",
},
["peak"] = {
["title"] = "",
["note-mid"] = "Peak only",
},
},
},
["Belgrave"] = {
["title"] = "[[Belgrave line]]",
["color"] = c.Belgrave,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Belgrave",
["types"] = {
["shuttle"] = {
["title"] = "",
["left terminus"] = "Ringwood",
["note-mid"] = "Shuttle service",
},
},
},
["Craigieburn"] = {
["title"] = "[[Craigieburn line]]",
["color"] = c.Craigieburn,
["left terminus"] = "Flinders Street",
["right terminus"] = "Craigieburn"
},
["Cranbourne"] = {
["title"] = "[[Cranbourne line]]",
["color"] = c.Cranbourne,
["text color"] = c.wht,
["left terminus"] = "S via M",
["right terminus"] = "Cranbourne",
["types"] = {
["old"] = {
["title"] = "",
["left terminus"] = "Flinders Street",
["note-mid"] = "",
},
["shuttle"] = {
["title"] = "",
["left terminus"] = "Dandenong",
["note-mid"] = "Shuttle service",
},
},
},
["Flemington Racecourse"] = {
["title"] = "[[Flemington Racecourse line]]",
["color"] = c.Flemington,
["text color"] = c.wht,
["left terminus"] = {"Southern Cross", "Flinders Street"},
["right terminus"] = {"Showgrounds", "Flemington Racecourse"},
},
["Frankston"] = {
["title"] = "[[Frankston line]]",
["color"] = c.Frankston,
["text color"] = c.wht,
["left terminus"] = "FS via CL",
["right terminus"] = "Frankston",
},
["Glen Waverley"] = {
["title"] = "[[Glen Waverley line]]",
["color"] = c.GlenWaverley,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Glen Waverley"
},
["Hurstbridge"] = {
["title"] = "[[Hurstbridge line]]",
["color"] = c.Hurstbridge,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Hurstbridge",
},
["Lilydale"] = {
["title"] = "[[Lilydale line]]",
["color"] = c.Lilydale,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Lilydale",
["types"] = {
["shuttle"] = {
["title"] = "",
["left terminus"] = "Ringwood",
["note-mid"] = "Shuttle service",
},
},
},
["Mernda"] = {
["title"] = "[[Mernda line]]",
["color"] = c.Mernda,
["text color"] = c.wht,
["left terminus"] = "Flinders Street",
["right terminus"] = "Mernda"
},
["Melbourne Airport"] = {
["title"] = "[[Melbourne Airport Rail|Airport line]]",
["note-mid"] = "(under construction)",
["color"] = c.Airport,
["text color"] = c.wht,
["left terminus"] = "EC via M",
["right terminus"] = "Melbourne Airport"
},
["Melton"] = {
["title"] = "[[Melton line]]",
["color"] = "279FD5",
["text color"] = c.wht,
["left terminus"] = "EC via M",
["right terminus"] = "Melton",
},
["Pakenham"] = {
["title"] = "[[Pakenham line]]",
["color"] = c.Pakenham,
["text color"] = c.wht,
["left terminus"] = "S via M",
["right terminus"] = "East Pakenham",
["types"] = {
["old"] = {
["title"] = "",
["left terminus"] = "FS via CL",
},
},
},
["Sandringham"] = {
["title"] = "[[Sandringham line]]",
["color"] = c.Sandringham,
["text color"] = c.blk,
["left terminus"] = "W via FS",
["right terminus"] = "Sandringham"
},
["Stony Point"] = {
["title"] = "[[Stony Point line]]",
["color"] = c.StonyPoint,
["text color"] = c.wht,
["left terminus"] = "Frankston",
["right terminus"] = "Stony Point"
},
["Suburban Rail Loop"] = {
["title"] = "[[Suburban Rail Loop]]",
["note-mid"] = "(under construction)",
["color"] = c.SuburbanRailLoop,
["text color"] = c.wht,
["left terminus"] = "Cheltenham",
["right terminus"] = "Werribee",
["icon"] = "[[File:Melbourne Suburban Rail Loop logo.svg|18px|link=Suburban Rail Loop]]"
},
["Suburban Rail Loop East"] = {
["title"] = "[[Suburban Rail Loop East]]",
["note-mid"] = "(under construction)",
["color"] = c.SuburbanRailLoop,
["text color"] = c.wht,
["left terminus"] = "Southland",
["right terminus"] = "Box Hill",
["icon"] = "[[File:Melbourne Suburban Rail Loop logo.svg|18px|link=Suburban Rail Loop]]"
},
["Sunbury"] = {
["title"] = "[[Sunbury line]]",
["color"] = c.Sunbury,
["text color"] = c.wht,
["left terminus"] = "EC via M",
["right terminus"] = {"Watergardens", "Sunbury"},
["types"] = {
["old"] = {
["title"] = "",
["color"] = "FFBE00",
["background color"] = "",
["text color"] = c.blk,
["left terminus"] = "Flinders Street",
["right terminus"] = "Sunbury",
},
},
},
["Upfield"] = {
["title"] = "[[Upfield line]]",
["color"] = c.Upfield,
["left terminus"] = "Flinders Street",
["right terminus"] = "Upfield"
},
["Werribee"] = {
["title"] = "[[Werribee line]]",
["color"] = c.Werribee,
["text color"] = c.blk,
["left terminus"] = "S via FS",
["right terminus"] = "Werribee",
["types"] = {
["old"] = {
["title"] = "",
["color"] = "028430",
["text color"] = c.wht,
["background color"] = "",
["left terminus"] = "F via FS",
},
},
},
["Williamstown"] = {
["title"] = "[[Williamstown line]]",
["color"] = c.Williamstown,
["text color"] = c.blk,
["left terminus"] = "S via FS",
["right terminus"] = "Williamstown",
["types"] = {
["shuttle"] = {
["title"] = "",
["left terminus"] = "Newport",
["note-mid"] = "Shuttle service",
},
["old"] = {
["title"] = "",
["color"] = "028430",
["text color"] = c.wht,
["background color"] = "",
["left terminus"] = "F via FS",
},
},
},
},
["aliases"] = {
["flemington"] = "Flemington Racecourse",
["airport"] = "Melbourne Airport",
}
}
return p;