Module:Infobox/Catch (personnalité)
Apparence
[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 Catch (personnalité).
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis la page Modèle:Documentation module d'infobox. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local general = require 'Module:Infobox/Fonctions'
local localdata = require 'Module:Infobox/Localdata'
local wikidata = require 'Module:Interface Wikidata'.fromLua
local person = require 'Module:Infobox/Fonctions/Personne'
local function getgender()
local vals = {
['Q6581072'] = 'f',
['Q6581097'] = 'm',
default = '?'
}
local gender = wikidata.formatStatements{entity = localdata.item, property = 'P21', displayformat = 'raw', numval = 1}
return vals[gender] or vals.default
end
local gender = getgender()
local function header()
local words = {
['m'] = {'Catcheur ', 'mort', 'retraité'},
['f'] = {'Catheuse ', 'morte', 'retraitée'},
['?'] = {'Catcheure (ou Catcheuse) ', 'mort(e)', 'retraité(e)'},
}
local text = words[gender]
local death = localdata['date de décès'] or wikidata.formatStatements{entity = localdata.item, property = 'P570'}
if death then
return text[1] .. text[2]
end
if localdata['fin de carrière'] then
return text[1] .. text[3]
end
return text[1] .. 'en activité'
end
local function nationality()
local nation = require 'Module:Country data'
local g = gender
if g == '?' then
g = 'm'
end
local function wd()
return {
entity = item,
property = 'P27',
conjtype = 'new line',
displayformat =
function(snak)
local flag, success = nation.standarddisplay(wikidata.getid(snak), {label = '-'})
if not success then
return wikidata.formatSnak(snak)
end
local nationality, success = nation.nationality(wikidata.getid(snak), 'm')
if not success then
return wikidata.formatSnak(snak)
end
return flag .. ' ' .. nationality
end
}
end
return {
type = 'row',
label = 'Nationalité',
plurallabel = 'Nationalités',
value = function(localdata)
local val, success = nation.nationality(localdata['nationalité'], g)
return val
end,
wikidata = wd()
}
end
return {
maincolor = '#dfedff',
parts = {
general.title('catch'),
general.mainimage('Article à illustrer Catch', 'Defaut 2.svg'),
{type = 'table', title = 'Données générales',
rows = {
{type = 'row', label = 'Nom de naissance', value = 'nom de naissance', wikidata = {property = 'P1477', numval = 1}},
{type = 'row', label = '[[Nom de scène|Nom de ring]]', plurallabel = '[[Nom de scène|Noms de ring]]', value = 'surnom', wikidata = {property = 'P1449', conjtype = 'new line'}},
nationality(),
person.birth(),
person.death(),
{type = 'row', label = 'Lieu de résidence', value = 'lieu de résidence', wikidata = {property = 'P551', showqualifiers = 'P131', numval = 1}},
{type = 'row', label = '[[Taille (anthropométrie)|Taille]]', value = 'taille', wikidata = {property = 'P2048', targetunit = 'metre', rounding = '2', numval = 1}},
{type = 'row', label = '[[Poids de forme|Poids]]', value = 'poids', wikidata = {property = 'P2067', targetunit = 'kilogram', rounding = '1', numval = 1}}
}
},
{type = 'table', title = header(),
rows = {
{type = 'row', label = 'Fédération(s)', value = 'fédérations'},
{type = 'row', label = 'Entraîneur(s)', singularlabel = 'Entraîneur', plurallabel = 'Entraîneurs', value = 'entraîneur', wikidata = {property = 'P286', conjtype = 'new line'}},
{type = 'row', label = 'Carrière pro.',
value = function(localdata)
if localdata['début de carrière'] then
if localdata['fin de carrière'] then
return localdata['début de carrière'] .. ' - ' .. localdata['fin de carrière']
else
return localdata['début de carrière'] .. ' - <i>aujourd\'hui</i>'
end
end
end
}
}
}
}
}