Module:Routelist row: Difference between revisions

Content deleted Content added
Display an em-dash instead of 0 in distance columns when neither length is passed.
Jackmcbarn (talk | contribs)
give a better error message for invalid dates
Line 67:
end
 
function dtsYeardtsYearCore(date, circa)
-- A limited replacement for {{dts}}. This is passed a date and derives a sort key from it. It returns a string with the hidden sort key, along with the year of the original date.
if not date then return false end -- If the date is an empty string, stop and go back to whence it came.
Line 83:
else -- Otherwise,
return dtsSpan .. year -- Return the hidden sort key concatenated with the year for this date.
end
end
 
function dtsYear(date, circa)
local success, result = pcall(dtsYearCore, date, circa)
if success then
return result
else
return string.format('%s<span class="error">Error: Invalid date "%s".</span>', circa and '<abbr title="circa">c.</abbr>&thinsp;' or '', date)
end
end