Module:Routelist row: Difference between revisions

Content deleted Content added
Allowing future row color
Rewriting gathering of arguments
Line 4:
}
 
--This function determines if this is a future route, present route, or decommissioned route, and colors the row appropriately.
function p.rowcolor(frame)
local pframe = frame:getParent()
--This function determines if this is a future route, present route, or decommissioned route, and colors the row appropriately.
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
--Import parameters from template
local established = frame.argsconfig[1]
local decommissioned = frame.argsconfig[2]
 
if p.lang:formatDate('Y-m-d') < established then --this is a future route
return "|- style=\"background-color:#ffdead;\" title=\"Future route\"\n"
elseif decommissioned ~= '0' then --this is a decommissioned route
return '|- style=\"background-color:#d3d3d3;\" title=\"Former route\"\n'
else --this is a normal route
Line 20 ⟶ 23:
end
 
--This function determines if this is a beltway or not, and displays the termini columns appropriately.
function p.termini(frame)
local pframe = frame:getParent()
--This function determines if this is a beltway or not, and displays the termini columns appropriately.
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
--Import parameters from template
local beltway = frame.argsconfig[1]
local terminus_a = frame.argsconfig[2]
local terminus_b = frame.argsconfig[3]
 
--The template passes this function thean stringempty "0"string if {{{beltway}}} is not specified by the template user.
if beltway ~= '0' then
return "|colspan=2 align=center|" .. beltway
else