« Module:Infobox/Trait » : différence entre les versions
mAucun résumé des modifications |
mAucun résumé des modifications Balise : Révoqué |
||
Ligne 1 : | Ligne 1 : | ||
local localdata = require('Module:Infobox/Localdata') | local localdata = require('Module:Infobox/Localdata') | ||
local abb = require('Module:Abréviation') | local abb = require('Module:Abréviation') | ||
function concatGames(localdata) | |||
local games = '' | |||
for i = 1, 8 do | |||
if localdata['jeux'..i] then | |||
games = games .. ',' .. localdata['jeux'..i] | |||
end | |||
end | |||
if games == '' then return nil end | |||
return games | |||
end | |||
function buildGamesTable(localdata, index) | function buildGamesTable(localdata, index) | ||
Ligne 20 : | Ligne 31 : | ||
return { | return { | ||
categories = { games = concatGames(localdata), name = 'Traits' }, | |||
parts = { | parts = { | ||
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Trait', link = 'Trait' }}, | { type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Trait', link = 'Trait' }}, |
Version du 21 juin 2021 à 12:05
Ce module contient le paramétrage de l'infobox {{Infobox trait}}.
local localdata = require('Module:Infobox/Localdata')
local abb = require('Module:Abréviation')
function concatGames(localdata)
local games = ''
for i = 1, 8 do
if localdata['jeux'..i] then
games = games .. ',' .. localdata['jeux'..i]
end
end
if games == '' then return nil end
return games
end
function buildGamesTable(localdata, index)
local row = { type = 'text' } --fake
if localdata['jeux'..index] then
if abb.links({ localdata['jeux'..index] }) then
row = { type = 'table', title = abb.links({ localdata['jeux'..index], 'Traits' }), rows = {
{ type = 'row', label = 'Exigences', value = 'requiert'..index },
{ type = 'row', label = 'Bénéfices', value = 'bonus'..index },
{ type = 'row', label = 'Pénalités', value = 'malus'..index },
{ type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid'..index }
}}
end
end
return row
end
return {
categories = { games = concatGames(localdata), name = 'Traits' },
parts = {
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Trait', link = 'Trait' }},
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
buildGamesTable(localdata, '1'),
buildGamesTable(localdata, '2'),
buildGamesTable(localdata, '3'),
buildGamesTable(localdata, '4'),
buildGamesTable(localdata, '5'),
buildGamesTable(localdata, '6'),
buildGamesTable(localdata, '7'),
buildGamesTable(localdata, '8'),
{ type = 'text', value = 'pied' }
}
}