« Module:Introduction de page-liste » : différence entre les versions

m
aucun résumé des modifications
Kharmitch (discussion | contributions)
mAucun résumé des modifications
Kharmitch (discussion | contributions)
mAucun résumé des modifications
 
(5 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
local p = {}
local p = {}


local abb = require('Module:Abréviation')
function p._build(args)
 
function p.build(frame)
local args = require('Module:Outils').extractArgs(frame)
local game    = args['jeu']
local game    = args['jeu']
local gameName = abb.name(game)
local gameName = require( 'Module:Abréviation' ).name(game)
local subject    = args['sujet'] or ''
local subject    = args['sujet'] or ''
Ligne 14 : Ligne 10 :


local mainSubjectLink = args['lien du sujet'] or subject
local mainSubjectLink = args['lien du sujet'] or subject
local categories = args['boîte de contenu'] ~= 'non'
local contentBox = args['catégorie'] ~= 'non'
local intro = ''
local intro = ''
Ligne 31 : Ligne 24 :
}
}
if categories then
return '<p>' .. intro .. '</p><ul>'
categories = abb.categories({ game, plural, '*' }) or ''
.. '<li>' .. puce[1] .. '</li>'
else
.. '<li>' .. puce[2] .. '</li>'
categories = ''
.. '<li>' .. puce[3] .. '</li>'
end
.. '</ul>'
.. '__TOC__'
.. '<div style="clear:both;"></div>'
end
 
function p.build(frame)
local args = {}
if contentBox then
local argsParent = frame:getParent().args
contentBox = require('Module:Boîte de contenu de jeu').build({ args = { nom = gameName }})
for cle, val in pairs(argsParent) do
else
if val then
contentBox = ''
val = mw.text.trim(val)
if val ~= '' then
args[cle] = mw.text.trim(val)
end
end
end
end
local intro = mw.html.create('div')
return p._build(args)
:addClass('avt-introduction')
:tag('p')
:wikitext(intro)
:done()
:tag('ul')
:tag('li'):wikitext(puce[1]):done()
:tag('li'):wikitext(puce[2]):done()
:tag('li'):wikitext(puce[3]):done()
:allDone()
local clear = '<div style="clear:both;">'
return contentBox .. tostring(intro) .. categories .. clear
end
end


return p
return p
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications