« Module:Infobox/Trait » : différence entre les versions

Kharmitch (discussion | contributions)
mAucun résumé des modifications
Balise : Révoqué
Kharmitch (discussion | contributions)
Harmonisation des identifiants techniques
 
(Une version intermédiaire par le même utilisateur non affichée)
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 22 : Ligne 11 :
{ type = 'row', label = 'Bénéfices', value = 'bonus'..index },
{ type = 'row', label = 'Bénéfices', value = 'bonus'..index },
{ type = 'row', label = 'Pénalités', value = 'malus'..index },
{ type = 'row', label = 'Pénalités', value = 'malus'..index },
{ type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid'..index }
{ type = 'row', label = '[[Form ID]]', value = 'formid'..index }
}}
}}
end
end
Ligne 31 : Ligne 20 :


return {
return {
categories = { games = function(localdata) return concatGames(localdata) end, 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' }},

Dernière version du 21 janvier 2023 à 16:31

Documentation du module

Ce module contient le paramétrage de l'infobox {{Infobox trait}}.

Documentation transclues de Module:Infobox/Trait/doc.
local localdata = require('Module:Infobox/Localdata')
local abb = require('Module:Abréviation')

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]]', value = 'formid'..index }
			}}
		end
	end
	
	return row
end

return {
	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' }
	}
}