Module:Timeline of release years: Difference between revisions

Content deleted Content added
m Steel1943 moved page Module:VG timeline to Module:Release timeline without leaving a redirect: Revert self
m tweak
Line 8:
table.insert(itemList, args[year] or args[year .. 'a'])
end
for asciiletter = 98, 106 do -- 98 ==> b, 106 ==> j
if args[year .. string.char(asciiletter)] then
table.insert(itemList, args[year .. string.char(asciiletter)])
Line 32:
if year >= beginyear and year <= endyear then
local _, _, color1, color2 = string.find( args['range' .. yearrange .. '_color'], '^(%S*)%s*(%S*)$' )
color2 = (string.find(color2, '^#?%w+$')) and color2 or color1
return (itemNum > 0) and color1 or color2
end
end
end
return (itemNum > 0) and '#0BDA51' or '#228B22'
end
 
local function left(builder, args, year, itemNum)
builder = builder:tag( 'td' )
:attr('scope', 'row')
:css('text-align', 'right') -- For year = 'TBA'
:css('border', 'none')
:css('padding', '5px3px')
:css('border-right', '20px16px solid ' .. color(args, year, itemNum))
:wikitext(year)
if itemNum > 1 then
Line 55 ⟶ 56:
 
local function right(builder, args, year, itemNum, itemList)
local outerPadding, innerPadding = '5px', '2px'
if itemNum == 0 then return end
if itemNum == 1 then
builder:tag('td')
:css('padding','5px' outerPadding)
:css('border', 'none')
:wikitext(itemList[1])
Line 68 ⟶ 70:
builder:tag('td')
:css('border', 'none')
:css('padding', outerPadding .. '5px 5px' 2px.. outerPadding .. 5px' ' .. innerPadding)
:wikitext(itemList[1])
Line 75 ⟶ 77:
:tag('td')
:css('border', 'none')
:css('padding','2px 5pxinnerPadding 2px.. 5px' ' .. outerPadding)
:wikitext(itemList[key])
end
Line 82 ⟶ 84:
:tag('td')
:css('border', 'none')
:css('padding','2px 5pxinnerPadding 5px.. 5px' ' .. outerPadding)
:wikitext(itemList[itemNum])
 
Line 105 ⟶ 107:
local ret
local firstyear, lastyear
local TBA = (items(args, 'TBA')) > 0 and true or false
ret = mw.html.create( 'table' )
:addClass('wikitable')
:css('border', 'none')
:css('float', args.align == 'left' and 'left' or 'right')
:css('clear', args.align == 'left' and 'left' or 'right')
:css('margin', args.align == 'left' and '0 1em 0.5ex 0' or '0 0 0.5ex 1em')
:css('font-size', '80%')
:css('line-height', '90%')
Line 119 ⟶ 122:
ret:tag('caption')
:css('padding', '5px 5px 0px') -- See outerPadding in function right()
:css('font-size', '112.5%') -- 90% / 80%
:wikitext(args.title and args.title or 'Timeline of release years')
:addClass('nowrap')
:wikitext(args.subtitle and string.format('<br /><span style="font-weight: normal;">%s</span>', args.subtitle), '')
:wikitext(args.title and args.title or 'Timeline of release years')
 
if args.subtitle then
ret:tag('tr'):tag('td')
:attr('colspan', '2')
:css('padding', '0px 5px 5px') -- See outerPadding in function right()
:css('border', 'none')
:css('text-align', 'center')
:wikitext(args.subtitle)
end
if tonumber(args.first) then
firstyear = tonumber(args.first)
else
for i = 1940, os.date('%Y') do
if (items(args, i)) > 0 then
firstyear = i
break
Line 138 ⟶ 151:
else
for i = os.date('%Y') + 3, TBA and os.date('%Y') or firstyear, -1 do
if (items(args, i)) > 0 then
lastyear = i
break