Module:Routelist row: Difference between revisions

Content deleted Content added
Adding entry point functions for local names and notes
Updating text to match current version of WP:USRD/STDS/L
Line 8:
removed: The string to be output in the "Removed" column. In the case of routeStates.former, the year that the route was decommissioned is output instead.
]]--
routeStates.current = {row = "|- \n", removed = "presentcurrent"} -- Data for current routes
routeStates.future = {row = '|- style="background-color:#ffdead;" title="Future route"\n', removedestablished = "proposed", removed = "–"} -- Data for future routes
routeStates.former = {row = '|- style="background-color:#d3d3d3;" title="Former route"\n'} -- Data for former routes
routeStates.unknown = {row = "|- \n", removed = "—"} -- Data for route with unknown status
Line 23:
elseif established == '' then -- Without the establishment date, there is not enough information to determine the status of the route.
return routeStates.unknown
elseif lang:formatDate("Y-m-d")established <== established'proposed' then -- If the current"established date (from lang:formatDate("Y-m-d")) is less than the date ofstring establishment'proposed', then it must be a future route.
return routeStates.future
else -- If none of the first three conditions are true, then it must be a current route.
Line 127:
end
 
function formed(routeState, established)
-- This function returns the proper value for the formed column.
return routeState.established or dtsYear(established) or "—" -- Returns 'proposed' if the route is proposed, the dtsYear-formatted established date or, if noneone was provided, or an em-dash.
end
 
Line 144:
local dates = {["established"] = established, ["decommissioned"] = decommissioned} -- This table encapsulates the given dates into one value...
local routeState = getRouteState(dates) -- which is passed to getRouteState, which returns one of the entries in routeStates,
local output = "|align=center|" .. formed(routeState, established) .. "||align=center|" .. removed(routeState, decommissioned) -- which is passed to the removed function. This line generates the Wikitext for this part of the row.
return output
end