Aller au contenu

Module:Infobox/Collection de livre-jeu

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 21 août 2017 à 04:49 et modifiée en dernier par PhiJai (discuter | contributions). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 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 Collection de livre-jeu.


local localdata = require( 'Module:Infobox/Localdata' )
local objet = require "Module:Infobox/Fonctions"
local wd = require "Module:Wikidata"
local util = require "Module:Utilitaire Wikidata"
local general = require 'Module:Infobox/Fonctions'
local linguistic = require 'Module:Linguistique'
local wikidata = require "Module:Interface Wikidata".fromLua
local countrymod = require "Module:Country data"




local occupationformats = {
	--{profession, profession, couleur titre, couleur sous-titre, couleur texte, icône)  doivent être classés du plus spécifique au plus général
	{'Q2872393', 'jeu-role', '#4C6099', '#7090E0', '#FFFFFF', 'jeu-role'},
}
local function setformat() --retourne une table contenant la couleur principale de l'infobox et l'icône de titre
	local occupations = wd.stringTable{ -- récupère les Qid des professions
		entity = localdata.item,
		property = 'P106',
		displayformat = 'raw',
		excludespecial = true
	}
	if not occupations or (#occupations > 1) then -- si plusieurs occupations, on ne sait pas laquelle choisir
		return  {'Q', '', '#4C6099', '#7090E0', '#FFFFFF', 'jeu-role'}
	end
	occupations = wd.addVals(occupations, {property = 'P279'}, 2) -- nombre d'étages de sous-classes à remonter
	for i, j in pairs(occupations) do
		for k, l in pairs(occupationformats) do
			if l[1] == j then
				return l
			end
		end
	end
	return {'Q', '', '#4C6099', '#7090E0', '#FFFFFF', 'jeu-role'}
end
local function setcharte()
	if localdata['charte'] then
		charte = localdata['charte']
		for i, j in pairs(occupationformats) do
			if j[2] == charte then
				return j
			end
		end
	end
	return setformat()
end
local personformat = setcharte()




return {

	maincolor = "##BFD7FF",
	parts = {
		objet.title(),
		objet.mainimage("Article à illustrer Collection de livre-jeu", "Defaut 2.svg"),
		{type = "table", rows = {
			{type = "mixed", label = "Type", value = "type", property = "P2561"},
			},
		},
		{type = "table", title = "Caractéristiques", rows = {
			{type = "mixed", label = "Image", plurallabel = "Images", value = "image", property = "P18"},
			{type = "mixed", label = "Légende", value = "legende", property	= "P2096"},
			{type = "mixed", label = "Support de publication", plurallabel = "Support", value = "support", property = "P31"},
			{type = "mixed", label = "Langue originale", value = "langueVO", property	= "P364"},
			{type = "mixed", label = "Pays d'origine", value = "paysVO", property	= "P495"},
			{type = "mixed", label = "Titre en VO", value = "titreVO", property = "P1476"},
	 		{type = "mixed", label = "Traducteur", value = "traducteur", property = "P655"},
			{type = 'mixed', label = 'Séries composant la collection', value = 'serie', wikidata = {property = {'P527'}, showunit = true, conjtype = 'new line', showqualifiers = {'P1114'}}},
			{type = "mixed", label = "Nombre de titres", value = "nbtitres", property = "P2635"},
			{type = "mixed", label = "Directeur(s) de collection", value = "dirigeant",  wikidata = {property = "P1037", conjtype = 'new line', showdate = true}},
			{type = 'row', label = 'Date de parution', value = 'parution', wikidata = function ( item ) return wikidata.mainDate(item) end},
			{type = "mixed", label = "Éditeur(s)", value = "editeur", wikidata = {property = "P123", conjtype = 'new line', showdate = true}},
			{type = "mixed", label = "Genre littéraire", value = "genre", property = "P136"},
			{type = "mixed", label = "ISSN", value = "ISSN", property = "P236"},
			{type = "mixed", label = "Système de règles", value = "regles", property = "P4151"},
			{type = 'mixed', label = 'Auteurs', value = 'Auteurs', wikidata = {property = {'P50'}, showunit = true, conjtype = 'new line', showqualifiers = {'P3740'}}},
			{type = 'mixed', label = 'Illustrateur des couvertures', value = 'Illustrateur des couvertures', wikidata = {property = {'P736'}, showunit = true, conjtype = 'new line', showqualifiers = {'P3740'}}},
			{type = 'mixed', label = 'Illustrateurs intérieur', value = 'Illustrateurs intérieur', wikidata = {property = {'P110'}, conjtype = 'new line', showqualifiers = {'P3740'}, showunit = true}},
			{type = "mixed", label = "Fiche planete-ldvelh", value = "planete", property = "P2720"},
			},
		}
	}
}