« Module:Infobox/Évènement » : différence entre les versions

aucun résumé des modifications
Kharmitch (discussion | contributions)
Page créée avec « local localdata = require('Module:Infobox/Localdata') function buildSubject(arg) local subject = 'Évènement' if arg then local types = { ['conflit militaire'] =… »
 
Kharmitch (discussion | contributions)
Aucun résumé des modifications
 
(6 versions intermédiaires par le même utilisateur non affichées)
Ligne 14 : Ligne 14 :
function buildColumns(localdata, prefix)
function buildColumns(localdata, prefix)
local res  = mw.html.create( 'div' )
local res  = mw.html.create( 'div' )
local style = 'display:grid;'
local style = 'display:grid;text-align:left;'
local isFirstColumn = true
local isFirstColumn = true
Ligne 22 : Ligne 22 :
if isFirstColumn then
if isFirstColumn then
isFirstColumn = false
isFirstColumn = false
style = style .. 'grid-template-columns:auto'
style = style .. 'grid-template-columns:1fr'
else
else
style = style .. ' auto'
style = style .. ' 1fr'
end
end
res :tag( 'div' )
res :tag( 'div' )
:wikitext( value )
:wikitext( value )
:done()
:done()
else
break
end
end
end
end
res:attr('style', style .. ';')
res :attr('style', style .. ';')
return res
:allDone()
if isFirstColumn then return end
return tostring(res)
end
end


Ligne 47 : Ligne 53 :
}},
}},
{ type = 'table', title = 'Belligérants', rows = {
{ type = 'table', title = 'Belligérants', rows = {
{ type = 'row1col', value = function(localdata) return buildFighters(localdata, 'combattant') end }
{ type = 'row1col', value = function(localdata) return buildColumns(localdata, 'combattant') end }
}},
}},
{ type = 'table', title = 'Commandants', rows = {
{ type = 'table', title = 'Commandants', rows = {
{ type = 'row1col', value = function(localdata) return buildFighters(localdata, 'commandant') end }
{ type = 'row1col', value = function(localdata) return buildColumns(localdata, 'commandant') end }
}},
}},
{ type = 'table', title = 'Forces en présence', rows = {
{ type = 'table', title = 'Forces en présence', rows = {
{ type = 'row1col', value = function(localdata) return buildFighters(localdata, 'forces') end }
{ type = 'row1col', value = function(localdata) return buildColumns(localdata, 'forces') end }
}},
}},
{ type = 'table', title = 'Pertes', rows = {
{ type = 'table', title = 'Pertes', rows = {
{ type = 'row1col', value = function(localdata) return buildFighters(localdata, 'pertes') end }
{ type = 'row1col', value = function(localdata) return buildColumns(localdata, 'pertes') end }
}},
}},
{ type = 'table', title = 'Évènements associés', rows = {
{ type = 'table', title = 'Évènements associés', rows = {
Ligne 62 : Ligne 68 :
{ type = 'row', label = 'Connexe', value = 'connexe' },
{ type = 'row', label = 'Connexe', value = 'connexe' },
{ type = 'succession', value = {
{ type = 'succession', value = {
before = localdata['précédent'],
before = function(localdata) return localdata['précédent'] end,
after  = localdata['suivant']
after  = function(localdata) return localdata['suivant'] end
}}
}}
}},
}},
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications