Module:Infobox/Personnage de JoJo's Bizarre Adventure

Une page de Wikipédia, l'encyclopédie libre.

 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 JoJo's Bizarre Adventure.


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 "''[[JoJo's Bizarre Adventure]]''"
	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", value = 'nom original'},
			{type = 'row', label = "Alias", value = 'alias'},
			{type = 'row', label = "Naissance", value = 'naissance'},
			{type = 'row', label = "Âge", value = 'age'},
			{type = 'row', label = "Origine", value = 'origine'},
			{type = 'row', label = "Décès", value = 'décès'},
			{type = 'row', label = "Sexe", value = 'sexe'},
			{type = 'row', label = "Cheveux", value = 'cheveux'},
			{type = 'row', label = "Yeux", value = 'yeux'},
			{type = 'row', label = "Taille", value = 'taille'},
			{type = 'row', label = "Poids", value = 'poids'},
			{type = 'row', label = "Domicile", value = 'domicile'},
			{type = 'row', label = "Activité", value = 'activité'},
			{type = 'row', label = "Affiliation", value = 'affiliation'},
			{type = 'row', label = "[[Stand (JoJo's Bizarre Adventure)|Stand]]", value = 'stand'},
			{type = 'row', label = "Pouvoirs", value = 'pouvoirs'},
			{type = 'row', label = "Arme", value = 'arme'},
			{type = 'row', label = "Famille", value = 'famille'},
			{type = 'row', label = "Entourage", value = 'entourage'},
			{type = 'row', label = "Ennemi de", value = 'ennemi de'},
		}, style = {['border-top']  = '2px solid'.. displayformat[3], ['border-bottom']  = '2px solid'.. displayformat[3]}
	},

	{type = 'table', 
		rows = {
                        {type = 'row', label = "Créé par", value = 'créé par'},
			{type = 'row', label = "Seiyu", value = 'seiyu'},
			{type = 'row', label = "Doubleur(s)", value = 'doubleur'},
			{type = 'row', label = "Première apparition", value = 'première apparition'},
			{type = 'row', label = "Dernière apparition", value = 'dernière apparition'},
		}
	},
	
	
}
}