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:Wikidata'
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'},
['?'] = {'Catcheur (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 wd = {
entity = item,
property = 'P27',
conjtype = 'new line',
displayformat =
function(snak)
local flag, success1 = nation.standarddisplay(wikidata.getId(snak), {label = '-'})
local nationality, success2 = nation.nationality(wikidata.getId(snak), g)
if not success1 or not success2 then
return wikidata.formatSnak(snak)
end
return flag .. ' ' .. nationality
end
}
local label = "Nationalité"
local value = function(localdata)
if not localdata['nationalité'] then
return nil
end
local flag, success1 = nation.standarddisplay(localdata['nationalité'], {label = '-'})
local nationality, success2 = nation.nationality(localdata['nationalité'], g)
if not success1 or not success2 then
return nil
end
if not localdata['nationalité2'] then
return flag .. ' ' .. nationality
end
local flag2, success1 = nation.standarddisplay(localdata['nationalité2'], {label = '-'})
local nationality2, success2 = nation.nationality(localdata['nationalité2'], g)
if not success1 or not success2 then
return flag .. ' ' .. nationality
end
label = "Nationalités"
return flag .. ' ' .. nationality .. '<br>' .. flag2 .. ' ' .. nationality2
end
return {type = 'row', label = label, singularlabel = 'Nationalité', plurallabel = 'Nationalités', value = value, wikidata = wd}
end
local function height()
local wd = {
entity = item,
property = 'P2048',
displayformat =
function(snak)
return wikidata.getDataValue(snak, {targetunit = 'metre', rounding = 2, showlink = true}) .. ' (' .. wikidata.getDataValue(snak, {targetunit = 'foot', rounding = 2, showlink = true}) .. ')'
end,
numval = 1
}
local value = function(localdata)
if not localdata['taille'] then
return nil
end
local convert = require 'Module:Conversion'.displayvalue
local metre = convert(localdata['taille'], 'metre', {showunit = true, rounding = 2, showlink = true})
local foot = convert(localdata['taille'], 'metre', {targetunit = 'foot', showunit = true, rounding = 2, showlink = true})
if metre == foot then
return metre
end
return metre .. ' (' .. foot .. ')'
end
return {type = 'row', label = '[[Taille (anthropométrie)|Taille]]', value = value, wikidata = wd}
end
local function weight()
local wd = {
entity = item,
property = 'P2067',
displayformat =
function(snak)
return wikidata.getDataValue(snak, {targetunit = 'kilogram', rounding = 0, showlink = true}) .. ' (' .. wikidata.getDataValue(snak, {targetunit = 'pound', rounding = 0, showlink = true}) .. ')'
end,
numval = 1
}
local value = function(localdata)
if not localdata['poids'] then
return nil
end
local convert = require 'Module:Conversion'.displayvalue
local kilogram = convert(localdata['poids'], 'kilogram', {showunit = true, rounding = 0, showlink = true})
local pound = convert(localdata['poids'], 'kilogram', {targetunit = 'pound', showunit = true, rounding = 0, showlink = true})
if kilogram == pound then
return kilogram
end
return kilogram .. ' (' .. pound .. ')'
end
return {type = 'row', label = '[[Poids de forme|Poids]]', value = value, 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]]', singularlabel = '[[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}},
height(),
weight()
}
},
{type = 'table', title = header(),
rows = {
{type = 'row', label = 'Fédération', value = 'fédérations'},
{type = 'row', label = 'Entraîneur', 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
}
}
}
}
}