Module:Liste d'articles par jeu
Ce module génère le tableau {{Liste d'articles par jeu}}.
local p = {}
local abb = require( 'Module:Abréviation' )
function p._build(args)
local res = mw.html.create( 'div' )
:addClass( 'infobox avt-infobox' )
local items = mw.html.create( 'table' )
:tag('caption')
:attr({ colspan = '2' })
:wikitext('Articles par jeu')
:done()
noneItem = true
for i = 1, 12 do
local game = args['jeu' .. i]
if game then
game = abb.name( game )
if game and #game > 0 then
local articles = args['articles' .. i]
if articles then
noneItem = false
local row = mw.html.create('tr')
:tag( 'th' )
:attr({ scope = 'row' })
:wikitext( "''[[" .. game .. "]]''" )
:done()
:tag( 'td' )
:tag( 'div' )
:wikitext('\n' .. articles .. '\n')
:done()
:done()
:allDone()
items:node(row)
end
else
break
end
else
break
end
end
if noneItem then
return ''
end
res :node( items )
:allDone()
return tostring(res)
end
function p.build(frame)
local args = {}
local argsParent = frame:getParent().args
for cle, val in pairs(argsParent) do
if val then
args[cle] = mw.text.trim(val)
end
end
return p._build(args)
end
return p