Module:Timeline of release years: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
no globals
Jackmcbarn (talk | contribs)
simplify
Line 4:
 
local function isYearReleased(args, year)
if args[year] then
return true
end
else
for i = 96, 105 do
if args[year .. string.char(i)] then
return true
end
end
end
end
 
local function color(args, year)
ifreturn isYearReleased(args, year) thenand '#0BDA51' or '#228B22'
return '#0BDA51'
else
return '#228B22'
end
end
 
local function titleItem(content)
local ret
if content ~= nil then
ret =return mw.html.create( 'span' ):wikitext( '– ' .. content .. '<br />' )
ret
:wikitext( '– ' .. content .. '<br />' )
end
return ret
end
 
local function left(args, year, displeft)
return mw.html.create( 'td' ):wikitext( (displeft or year) .. ' –' )
local ret
ret = mw.html.create( 'td' )
ret
:wikitext( (displeft or year) .. ' –' )
return ret
end
 
local function center(args, year)
ret =return mw.html.create( 'td' )
local ret
ret = mw.html.create( 'td' )
ret
:css( 'width', '10px' )
:css( 'border', '1px solid black' )
:css( 'background-color', color(args, year) )
return ret
end
 
Line 64 ⟶ 40:
local ret
ret = mw.html.create( 'td' )
 
ret
:node( titleItem(args[year]) or titleItem(args[year .. 'a' ]) )
 
Line 76 ⟶ 50:
 
local function row(args, year, displeft)
ret =return mw.html.create( 'tdtr' )
local ret
ret = mw.html.create('tr')
ret
:node( left(args, year) )
:node( center(args, year) )
:node( right(args, year) )
return ret
end
 
Line 99 ⟶ 68:
local firstyear, lastyear
ret = mw.html.create( 'table' )
ret
:css('float', args.align or 'right')
:css('clear', args.align or 'right')
Line 110 ⟶ 77:
:attr('summary', args.summary or '')
ret:nodetag('caption')
do
:css('font-weight', 'bold')
local caption
:wikitext(args.title or 'Timeline of release years')
caption = mw.html.create('caption')
caption
:css('font-weight', 'bold')
:wikitext(args.title or 'Timeline of release years')
ret:node(caption)
end
 
if tonumber(args.first) then