Content deleted Content added
use convert to calculate lengths |
fix |
||
Line 29:
else -- If none of the first three conditions are true, then it must be a current route.
return routeStates.current
--- Return output for the length columns for a given route, with the appropriate conversions.▼
local function length(args)▼
local mi = args["length_mi"] or '' -- Length in miles▼
if mi == '' and km == '' then▼
return format("|align=right|—||align=right|—")▼
elseif mi ~= '0' and km == '' then▼
return format("|align=right|") .. mi .. ref .. format("||align=right|") .. frame:expandTemplate{ title = 'convert', args = { mi, "mi", "km", disp = "output number only"}}▼
return format("|align=right|") .. km .. ref .. format("||align=right|") .. frame:expandTemplate{ title = 'convert', args = { km, "km", "mi", disp = "output number only"}}▼
end
end
Line 127 ⟶ 112:
end
▲--- Return output for the length columns for a given route, with the appropriate conversions.
▲local function length(args)
local
▲ if mi == '' and km == '' then
▲ return format("|align=right|—||align=right|—")
▲ elseif mi ~= '0' and km == '' then
▲ return format("|align=right|") .. mi .. ref .. format("||align=right|") .. frame:expandTemplate{ title = 'convert', args = { mi, "mi", "km", disp = "output number only"}}
else
▲ return format("|align=right|") .. km .. ref .. format("||align=right|") .. frame:expandTemplate{ title = 'convert', args = { km, "km", "mi", disp = "output number only"}}
end
end
|