Module:Routelist row: Difference between revisions

Content deleted Content added
m Removing unnecessary import
Adding in-cell references and re-instituting length cell ordering based on passed parameter (km or mi)
Line 160:
local miles = args["length_mi"] or '' -- Length in miles
local kilometers = args["length_km"] or '' -- Length in kilometers
local lengths = {length_mi = miles, length_km = kilometers} -- This time, we compile the lengths into a table,
local Lengths = getLength(lengths) -- which makes for an easy parameter. This function call will return the lengths in both miles and kilometers,
return "|align=right|" .. Lengths.mi .. "||align=right|" .. Lengths.km -- which are then spliced in here and returned to the template.
local lengthRef = args["length_ref"] or ''
local first, second
if kilometers ~= '' then
first = Lengths.km
second = Lengths.mi
else
first = Lengths.mi
second = Lengths.km
end
return "|align=right|" .. Lengthsfirst .mi. lengthRef .. "||align=right|" .. Lengths.kmsecond -- which are then spliced in here and returned to the template.
end