Content deleted Content added
allowed dates before 1940 (see: Pauline Epistles) |
Implement compressempty |
||
Line 20:
if args[year .. '_color'] then
return args[year .. '_color']
end
if args.compressempty then
if(string.len(year) > 4) then
year = string.sub(year,1,4)
end
end
for yearrange = 1,
if args['range' .. yearrange] and args['range' .. yearrange .. '_color'] then
local _, _, beginyear, endyear = string.find( args['range' .. yearrange], '^(%d%d%d%d)%D+(%d%d%d%d)$' )
Line 51 ⟶ 57:
end
local function right(builder
if itemNum == 0 then return end
Line 79 ⟶ 85:
end
local function row(builder, args, year, emptyyear, lastyear)
local itemNum, itemList = items(args, year)
-- 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 then
-- If we're compressing and there's no items, return this year for tracking.
if #itemList < 1 then
return year
end
-- If we have items but are tracking an empty year, output compressed range row.
if emptyyear ~= nil then
builder = builder:tag('tr')
if year == 'TBA' then
left(builder, args, emptyyear .. '–' .. lastyear, 0)
else
if year-1 == emptyyear then
left(builder, args, emptyyear, 0)
else
left(builder, args, emptyyear .. '–' .. (year-1), 0)
end
end
end
end
builder = builder:tag('tr')
left(builder, args, year, itemNum)
right(builder
return nil
end
--------------------------------------------------------------------------------
Line 133 ⟶ 165:
end
local emptyyear = nil
for year = firstyear, lastyear do
local yearcheck = row(ret, args, year, emptyyear, lastyear)
if (emptyyear == nil and yearcheck ~= nil) or (emptyyear ~= nil and yearcheck == nil) then
emptyyear = yearcheck
end
end
|