Module:Infobox/Personnage de One Piece

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Personnage de One Piece.


local general = require "Module:Infobox/Fonctions"
local wd = require "Module:Wikidata"
local localdata = require "Module:Infobox/Localdata"

local chartes = {

-- {titre charte, élément wikidata, couleur titre, couleur sous-titre, couleur texte, pictogramme}
	{'defaut', '', '#336699', '#336699', '#FFFFFF', 'persofiction'}, -- Défaut
}

local function setformat()
	local instanceof = wd.getIds(localdata.item, {property = 'P31'})

	if not instanceof then
		return  {'Q', '', '#336699', '#336699', '#FFFFFF', 'persofiction'}
	end
	instanceof = wd.addVals(instanceof, {property = 'P279'}, 2)
	for i, j in pairs(instanceof) do
		for k, l in pairs(chartes) do
			if l[2] == j then
				return l
			end
		end
	end
	return {'Q', '', '#336699', '#336699', '#FFFFFF', 'persofiction'}
end

local function setcharte()
	local charte = localdata['charte']
	if charte then
		for i, j in pairs(chartes) do
			if j[1] == charte then
				return j
			end
		end
	end
	return setformat()
end

local displayformat = setcharte()

--Prime

local function prime()
	local value = localdata['prime']
	if not value then
		return nil
	else
	return localdata['prime'] .. ' ' .. '[[Fichier:Berrysymbol.gif|Berry]]'
	end
end

localdata['prime'] = prime()

-- Texte Oeuvre
local function oeuvres()
	local oeuvres = wd.getClaims{entity = item, property = 'P1441'}
	if (not oeuvres) then
		return "''[[One Piece]]''"
	end
	return wd.formatAndCat{entity = item, property = 'P1441', claims = oeuvres, conjtype = 'comma'}, #oeuvres
end

local function textopus()
	if localdata ['oeuvre'] then
		return "[[Personnage de fiction]] apparaissant dans ".. localdata ['oeuvre']
		else
			return "[[Personnage de fiction]] apparaissant dans "..oeuvres()
	end
end		

local function opus()
		local rows = {}	
		do
			table.insert (rows, {
			type = 'row',
		value = 'texte opus'
		})
	end
	return rows
end

localdata['texte opus'] = textopus()

-- localdata ['sous-titre'] = textopus() (ne va pas au bon endroit)

-- Partie principale

return 
	{
	maincolor = displayformat[3],
	secondcolor = displayformat[4],
	thirdcolor = displayformat[5],
	parts =
    	{
	general.title(displayformat[6], nil, 'sous-titre', nil),
	{type = 'table', rows = opus(), style = { ['text-align'] = 'center', ['border-bottom']  = '2px solid'.. displayformat[3]}},
	general.mainimage('Article à illustrer Personnage (fiction)', 'Defaut 2.svg'),
	
	{type = 'table', 
		rows = {
			{type = 'row', label = "Nom original (Kanji)", value = 'nom original (kanji)', property = {'P1559', 'P1814'}},
			{type = 'row', label = "Nom original (Romaji)", value = 'nom original (romaji)'}, --P2125 appliqué au nom précédent
			{type = 'row', label = "Alias", value = 'alias'},
			{type = 'row', label = "Épithète", value = 'épithète'},
			{type = 'row', label = "Épithète (Kanji)", value = 'épithète (kanji)'},
			{type = 'row', label = "Épithète (Romaji)", value = 'épithète (romaji)'},
			{type = 'row', label = "Première apparition", value = 'première_apparition'},
			{type = 'row', label = "Dernière apparition", value = 'dernière_apparition'},
			{type = 'row', label = "Seiyu", value = 'seiyu', property = 'P725'},
			{type = 'row', label = "Doubleur", value = 'doubleur'}, -- P725 aussi, mais avec le langage fr
		}, style = {['border-top']  = '2px solid'.. displayformat[3], ['border-bottom']  = '2px solid'.. displayformat[3]}
	},

	{type = 'table', 
		rows = {
			{type = 'row', label = "Commandant", value = 'leader'},
			{type = 'row', label = "Navire", value = 'navire'},
			{type = 'row', label = "Âge", value = 'age'},
			{type = 'row', label = "Statut", value = 'statut'},
			{type = 'row', label = "Anniversaire", value = 'anniversaire', property = 'P3150'},
			{type = 'row', label = "Habitat", value = 'habitat'},
			{type = 'row', label = "Origine", value = 'origine'},
			{type = 'row', label = "Fruit du démon", value = 'fruit du démon'},
			{type = 'row', label = "Fruit du démon (Kanji)", value = 'fruit du démon (kanji)'},
			{type = 'row', label = "Fruit du démon (Romaji)", value = 'fruit du démon (romaji)'},
			{type = 'row', label = "Type", value = 'type'},
			{type = 'row', label = "Fluide", value = 'fluide'},
			{type = 'row', label = "Arme", value = 'arme', property = 'P520'},
			{type = 'row', label = "Pouvoirs", value = 'pouvoirs', property = 'P2563'},
					}, style = {['border-bottom']  = '2px solid'.. displayformat[3]}
	},

	{type = 'table', 
		rows = {
			{type = 'row', label = "Parenté", value = 'parenté', property = 'P1038'}, --père : P22, mère : P25, frères et soeurs : P3373
			{type = 'row', label = "Occupation", value = 'occupations', property = 'P106'},
			{type = 'row', label = "Affiliation", value = 'affiliation', property = 'P463'},
			{type = 'row', label = "Entourage", value = 'entourage'},
			{type = 'row', label = "Groupe sanguin", value = 'groupe_sanguin', property = 'P1853'},
			{type = 'row', label = "Couleur des yeux", value = 'couleur_des_yeux', property = 'P1340'},
			{type = 'row', label = "Couleur des cheveux", value = 'couleur_des_cheveux', property = 'P1884'},
			{type = 'row', label = "Taille", value = 'taille', property = 'P2048'},
			{type = 'row', label = "Poids", value = 'poids', property = 'P2067'},
			{type = 'row', label = "Doriki", value = 'doriki'},
			{type = 'row', label = "Numéro de gladiateur", value = 'numéro_gladiateur'},
			{type = 'row', label = "Prime", value = 'prime'},
		}
	},
	
	
}
}