Module:Timeline of release years/sandbox: Difference between revisions

Content deleted Content added
Perhaps inelegant, a first attempt at doing _to that works with a-z year specifications.
Inactive years shouldn't use a range, period. Because we're looping over this repeatedly now, we also need to make sure compressempty only processes on the first loop, when oldrange is nil. Also, on the second+ loop, there may not be any items left to output. Avoid outputting a false inactive row.
Line 110:
 
local function row(builder, args, year, emptyyear, lastyear)
local oldrange = nil
repeat
Line 117:
-- If compressempty is set, check for empty items, track empty years, and
-- put out a compressed range when next year is found.
if args.compressempty and oldrange == nil then
-- If we're compressing and there's no items, return this year for tracking.
if #itemList < 1 then
Line 127:
builder = builder:tag('tr')
if year == 'TBA' then
left(builder, args, emptyyear .. '–' .. lastyear, 0, range0)
else
if year-1 == emptyyear then
left(builder, args, emptyyear, 0, range0)
else
left(builder, args, emptyyear .. '–' .. (year-1), 0, range0)
end
end
end
end
-- We can break out if this is the case. This means we have looped through more than once, but there were no more items remaining.
if range == 0 and oldrange and #itemList < 1 then
break
end
 
Line 141 ⟶ 146:
left(builder, args, year, itemNum, range)
right(builder, itemNum, itemList)
 
if range ~= 0 then
oldrange = range