تضامنًا مع حق الشعب الفلسطيني |
وحدة:Infobox/Fonctions/Compétition sportive
اذهب إلى التنقل
اذهب إلى البحث
توثيق الوحدة[أنشئ] [محو الاختزان][استخدامات] [قوالب]
local p = {}
local wikidata = require "Module:Wikidata/fr"
local countrymod = require "Module:Country data"
local typeofteam = require "Module:Dictionnaire Wikidata/Typeofteam"
-- date de la course pour adapter les drapeaux et nationalités des participants
local raceDate = wikidata.formatStatements{entity = item, property = {'P580', 'P585'}, numval = 1, displayformat = 'raw'}
local function formatPerson(person) -- retourne le nom d'une personne précédé du ou des drapeaux appropriés
local str = wikidata.formatEntity(person)
-- récupère la nationalité telle que stockée dans P27 (personnes) ou P17 (équipes)
local nationalities = wikidata.stringTable{entity = person, property = {'P27', 'P17'}, atdate = raceDate, displayformat = 'raw'}
if not nationalities then
return str
end
local flags = {}
for i, nation in pairs(nationalities) do
local flag, success = countrymod.standarddisplay(nation, {label = '-', date = 'default'})
if success then
str = flag .. ' ' .. str
end
end
return str
end
function p.winnerRow(label, winnertype)
local function wikidataval(winnertype)
if not winnertype then -- si l'on ne connait pas le qualificatif, ne pas utiliser Wikidata
return nil
end
local winners = wikidata.stringTable{entity = item, property = 'P1346', displayformat = 'raw', excludespecial = true, qualifier = 'P642', qualifiervalue = winnertype}
if not winners then
return nil
end
for i, winner in pairs(winners) do
winners[i] = formatPerson(winner)
end
local str = table.concat(winners, '<br />')
-- ajout rétrolien et cat
str = wikidata.formatAndCat{value = str, entity = entity, property = 'P1346'}
return str
end
return {type = 'row', label = label, value = param, wikidata = function() return wikidataval(winnertype) end}
end
function p.winnerRow2(label, param, winnertype)
local function wikidataval(winnertype)
if not winnertype then -- si l'on ne connait pas le qualificatif, ne pas utiliser Wikidata
return nil
end
local winners = wikidata.stringTable{entity = item, property = 'P1346', displayformat = 'raw', excludespecial = true, qualifier = 'P642', qualifiervalue = winnertype}
if not winners then
return nil
end
for i, winner in pairs(winners) do
winners[i] = formatPerson(winner)
end
local str = table.concat(winners, '<br />')
-- ajout rétrolien et cat
str = wikidata.formatAndCat{value = str, entity = entity, property = 'P1346'}
return str
end
return {type = 'row', label = label, value = param, wikidata = function() return wikidataval(winnertype) end}
end
function p.typeofteam()
return {
type = 'row',
value = 'compet',
wikidata = {
property = 'P31',
showdate = true,
conjtype = '<br />',
sorttype = 'chronological',
speciallabels = typeofteam,
},
label = 'Statut',
plurallabel = 'Statuts'
}
end
return p