وحدة:ب.ص.م/أدوات/شخص
مراجعة 00:36، 4 أبريل 2021 بواسطة Ahmad A Najar (نقاش | مساهمات) (أنشأ الصفحة ب'-- Functions utilisées par les infobox personnes local p = {} local localdata = require 'وحدة:ب.ص.م/بيانات' local item = localdata.item local wikidata = re...')
يمكن إنشاء صفحة توثيق الوحدة في وحدة:ب.ص.م/أدوات/شخص/شرح
-- Functions utilisées par les infobox personnes local p = {} local localdata = require 'وحدة:ب.ص.م/بيانات' local item = localdata.item local wikidata = require 'Module:Wikidata/fr' local general = require 'وحدة:ب.ص.م/أدوات' local datemodule = require 'Module:Date' local complexdate = require 'Module:Date complexe' local linguistic = require 'Module:Linguistique' --local militaryranks = require 'Module:Dictionnaire Wikidata/Grades militaires' --local wdname = require 'Module:Wikidata/Nommage' --=== Accord en genre -- établit la variable gender pour l'élément local function getgender(id) local vals = { ['Q6581072'] = 'f', -- féminin ['Q6581097'] = 'm', -- masculin ['Q1052281'] = 'f', -- femme transgenre ['Q2449503'] = 'm', -- homme transgenre ['Q43445'] = 'f', -- femelle ['Q44148'] = 'm', -- mâle default = '?' } local gender = wikidata.formatStatements{entity = id, property = 'P21', displayformat = 'raw'} return vals[gender] or vals.default end local function nbr_in_arabic(nb,sing,dbl,plur) if tonumber(nb) then if(tonumber(nb) == 1) then return sing..' واحدة' elseif(tonumber(nb) == 2) then return dbl elseif(tonumber(nb)>2 and tonumber(nb)<10) then return nb..' '..plur else return nb..' '..sing end else return nb end end local gender = getgender(item) -- récupération des libellés genrés de Wikidata local function genderedlabel(id, labelgender) local label if not labelgender then labelgender = gender -- si le genre n'est pas indiqué, c'est celui de la personne dont c'est l'infobox end if labelgender == 'f' then -- femme : chercher le libellé dans P2521 (libellé féminin) label = wikidata.formatStatements{entity = id, property = 'P2521', isinlang = 'ar', numval = 1, ucfirst = '-'} elseif labelgender == 'm' then -- homme : chercher le libellé dans P3321 (libellé masculin) label = wikidata.formatStatements{entity = id, property = 'P3321', isinlang = 'ar', numval = 1, ucfirst = '-'} end if not label then label = wikidata.getLabel(id) end return label end -- === Gestion des dates -- Liens thématiques vers les dates local datelinks = { -- lien vers le domaine d'activité approprié Q483501 = 'en arts plastiques', -- artiste Q1028181 = 'en arts plastiques', -- peintre Q1281618 = 'en arts plastiques', -- sculpteur Q2309784 = 'en cyclisme', -- cycliste Q16947657 = 'en arts plastiques', -- lithographe Q11569986 = 'en arts plastiques', -- graveur Q13365770 = 'en arts plastiques', -- graveur sur cuivre Q21925567 = 'en arts plastiques', -- sérigraphe Q10862983 = 'en arts plastiques', -- aquafortiste } local function getdatetopic() -- obtient le lien le plus approprié pour une date en fonction de la profession local claims = wikidata.stringTable{entity = item, property = 'P106', excludespecial = true, displayformat = 'raw'} if not claims then return nil end for i, j in pairs(claims) do if datelinks[j] then return datelinks[j] end end end local linktopic = getdatetopic() local unknowndatelabel = 'تاريخ غير معروف' local birthdate = localdata['ميلاد'] or localdata['تاريخ الميلاد'] or wikidata.formatAndCat{ entity = item, property = 'P569', unknownlabel = unknowndatelabel, minprecision = 9, conjtype = 'or', sorttype = 'chronological' } local dead = wikidata.getClaims{entity = item, property = 'P570'} --utilisé comme booléen qui dit si une personne est morte pour modifier certaines élément d'affichage local deathdate = localdata['وفاة'] or localdata['تاريخ الوفاة'] local wddeathdate = wikidata.formatAndCat{ entity = item, property = 'P570', unknownlabel = unknowndatelabel, minprecision = 9, conjtype = 'or', sorttype = 'chronological', } local function format1(event, period, predecessor, together, successor, displayformat) local mainstr = event if predecessor then local s = 'سبقه ' .. predecessor if gender == 'f' then s = 'سبقها ' .. predecessor end mainstr = mainstr .. '<small><br /> ' .. s .. '</small>' end if together then local s = 'مع ' .. together mainstr = mainstr .. '<small><br /> ' .. s .. '</small>' end if successor then local s = 'لحقه ' .. successor if gender == 'f' then s = 'لحقها ' .. successor end mainstr = mainstr .. '<small><br /> ' .. s .. '</small>' end return {type = 'row', label = period or '', value = function() return mainstr end} end ----------------- local function format2(event, period, predecessor, together, successor, displayformat) if (not event) then return nil end local rows = {} local eventrow = {type = 'row1col', color = 'secondcolor', value = event } table.insert(rows, eventrow) if period then period = '<span style="font-weight:normal">' .. period .. '</span>' local periodrow = {type = 'row1col', color = '#F9F9F9', value = period } table.insert(rows, periodrow) end if predecessor then local prederow = {type = 'row', label = 'Prédécesseur', value = function() return predecessor end} table.insert(rows, prederow) end if together then local succrow = {type = 'row', label = 'Avec', value = function() return together end} table.insert(rows, succrow) end if successor then local succrow = {type = 'row', label = 'Successeur', value = function() return successor end} table.insert(rows, succrow) end return {type = 'multi', rows = rows} end local function format3(event, period, predecessor, together, successor, displayformat, details) if details then details = '<span style="font-weight:normal">' .. details .. '</span>' event = linguistic.conj({event, details}, 'new line') end local mainrow = {type = 'row1col', color = 'secondcolor', value = event } if period then period = '<span style="font-weight:normal">' .. period .. '</span>' end local periodrow = {type = 'row1col', color = '#F9F9F9', value = period } local successionrow = { style = {['background-color'] = '#F9F9F9', ['padding-bottom'] = '2%'}, type = 'navbox', inner = true, previousval = function() return predecessor end, nextval = function() return successor end, } return {type = 'multi', rows = {mainrow, periodrow, successionrow}} end local function timeline(localparam, wdconf, timelineformat, title, singtitle, details) -- affiche date : événement (suppose les événements déjà triés) local rows = {} local function returnTable() return { type = 'table', title = title, rows = rows } end -- avec données locales local val = localdata[localparam] if val == '-' then return nil elseif val then table.insert(rows, {type = 'row1col', color = 'secondcolor', value = val}) return returnTable() end -- avec données wikidata if not wdconf then return nil end wdconf.entity = wdconf.entity or item wdconf.sorttype = wdconf.sorttype or 'chronological' wdconf.labelformat = wdconf.labelformat or function(id) return genderedlabel(id) end wdconf.linktopic = wdconf.linktopic or '-' wdconf.stilltrue = not dead -- si la personne est vivante, on emploie "depuis" plutôt que "à partir de" (mais lorsque c'est fini mais que la date de fin manque, ça devient faux) local statements = wikidata.getClaims(wdconf) if not statements then return nil end if #statements == 1 then title = singtitle end local displayformats = { A = format1, B = format2, C = format3, } local applyformat = displayformats[timelineformat] or displayformats['A'] rows = {} for i, statement in pairs(statements) do local event = linguistic.ucfirst(wikidata.formatStatement(statement, wdconf)) local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'}) local together = wikidata.getFormattedQualifiers(statement, {'P1706', ''}) local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'}) local period = wikidata.getFormattedDate(statement, {linktopic = wdconf.linktopic, stilltrue = not dead } ) -- dont pass all wdconf or else qualifiers will show up local detailstr if type(details) == 'function' then detailstr = details(statement) end local row = applyformat(event, period, predecessor, together, successor, wdconf, detailstr) if row then table.insert(rows, row) end end table.insert(rows, {type = 'external text', value = function() return wikidata.addTrackingCat(wdconf.property) end}) return returnTable() end local function dateandplace(thedate, theplace) if thedate and theplace and mw.ustring.find(thedate, 'غير معروف') and mw.ustring.find(theplace, 'غير معروف') then theplace = nil thedate = mw.ustring.gsub(thedate, linguistic.ucfirst(unknowndatelabel), 'التاريخ والمكان غير معروفين') end return linguistic.conj({thedate, theplace}, 'new line') end --Titre function p.title(icon, style) return general.title(icon, style) end --Image function p.mainimage(cat) -- demande d'illustration que si la personne est née ou morte après 1900, sinon c'est souvent impossible à trouver local defaultimage = 'Image of none.svg' local age = wikidata.stringTable{property = 'P569,P570', entity = item, displayformat = 'raw', excludespecial = true} if age then local pattern = '(%W)(%d+)%-(%d+)%-(%d+)' local era, year = age[1]:match(pattern) if (era == '-') or (tonumber(year)) < 1900 then defaultimage = nil end end return general.mainimage(cat --[[or 'Article à illustrer Biographie']], defaultimage) end -- الأسماء function p.birthname(isSubTitle) local birthnamerow = { -- un peu particulier, donc à part wikidata = function() local s = wikidata.formatAndCat{entity = item, property = 'P1559',showlang=true} if (not s) then return nil end -- regarde si le nom de la valeur ressemble au libellé (en tenant compte de la pollution des marqueures de langue local label = mw.ustring.lower(wikidata.getLabel(item) or '') local useless if mw.ustring.find(mw.ustring.lower(s), mw.ustring.lower(label), 0, true) then useless = true end if useless then return nil end return s end, } if(isSubTitle) then birthnamerow.type = 'subtitle' else birthnamerow.type = 'row' birthnamerow.label = 'الاسم في اللغة الأم' --plurallabel = 'Noms dans la langue maternelle', birthnamerow.value = 'اسم في اللغة الأم' end return birthnamerow end function p.othernames() local names = { {'P1477', 'اسم عند الولادة', 'Noms de naissance', 'اسم عند الولادة'}, {'P1448', 'الاسم الرسمي', 'Noms officiels', 'اسم رسمي'}, {'P1449', 'الكنية', 'الكنية', 'كنية'}, {'P2001', 'Romanisation révisée', 'Romanisation révisée', 'nom de pinceau'}, {'P1942', 'McCune-Reischauer', 'McCune-Reischauer', 'nom de pinceau'}, {'P742', 'Pseudonyme', 'Pseudonymes', 'pseudonyme'}, {'P1782', 'Prénom social', 'Prénoms sociaux', 'prénom social'}, {'P1786', 'Nom posthume', 'Noms posthumes', 'nom posthume'}, {'P1785', 'Nom de temple', 'Noms de temple', 'nom de temple'}, {'P1787', 'Nom de pinceau', 'Noms de pinceau', 'nom de pinceau'}, {'P428', 'Abréviation en botanique', 'Abréviations en botanique', 'abréviation en botanique'}, {'P835', 'Abréviation', 'Abréviations', 'abréviation'}, -- abréviation d'auteur habituelle hors botanique {'P1813', 'الاسم المختصر', 'الأسماء المختصرة', 'اسم مختصر'}, {nil, 'أسماء أخرى', 'أسماء أخرى', 'أسماء أخرى'}, } local rows = {type = 'multi', rows = {}} for i, j in pairs(names) do local query if j[1] and not localdata['أسماء أخرى'] then -- lorsqu'il y a un paramètre "autres noms", Wikidata est désactivée pour éviter risques de doublon query = {property = j[1], showqualifiers = {'P1721'}, conjtype = 'new line'} end table.insert(rows.rows, {type = 'row', value = j[4], wikidata = query, label = j[2], plurallabel = j[3]}) end return rows end -- NAISSANCE ET MORT function p.birth() -- date de naissance en première ligne, lieu de naissance en deuxième return { type = 'row', label = 'الميلاد', value = function() local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate or '', [3] = deathdate or wddeathdate or '', qualificatif = linktopic}} local theplace = localdata['مكان الولادة'] or localdata['مكان الميلاد'] or wikidata.formatAndCat({entity =item, -- affichage du nom du lieu de naissance en vigueur à la date de naissance property= 'P19', rank = 'best', labelformat = function(val) return wikidata.formatStatements{entity = val, property = "P1448", atdate = wikidata.formatStatements{entity = item, property = 'P569', displayformat = 'raw'} or 'today', numval = 1, isinlang = 'ar'} or wikidata.getLabel(val) end, conjtype= ' أو ', unknownlabel = "مكان غير معروف" } ) return dateandplace(thedate, theplace) end } end function p.death() -- même fonctionnement que la fonction p.birth -- date de disparition local disappeardate = localdata['اختفاء'] if not deathdate then -- récupérée de Wikidata seulement si la date de décès n'est pas fournie en locale disappeardate = wikidata.formatStatements{entity = item, property = "P746"} end -- date de décès local ddate = deathdate --déclarée pour l'ensemble du module if (not ddate) and (not disappeardate) then deathdate = wddeathdate -- récupérée de Wikidata seulement si la date de disparition n'est pas fournie en locale end local thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate or '', qualificatif = linktopic, unknownlabel = 'date inconnue'}} local theplace = localdata['lieu de décès'] or wikidata.formatAndCat{entity =item, property= 'P20', rank = 'best', -- affichage du nom du lieu de décès en vigueur à la date de décès labelformat = function(val) return wikidata.formatStatements{entity = val, property = "P1448", atdate = wikidata.formatStatements{entity = item, property = 'P570', displayformat = 'raw'} or 'today', numval = 1, isinlang = 'ar'} or wikidata.getLabel(val) end, conjtype= ' أو ', unknownlabel = "مكان غير معروف"} local val = dateandplace(thedate, theplace) return {type = 'multi', rows = { { -- disparition type = 'row', label = 'الاختفاء', value = function() return disappeardate end }, { -- décès type = 'row', label = 'الوفاة', value = function() return val end, } }} end function p.floruit() return { type = 'row', label = "فترة النشاط", value = "فترة النشاط", wikidata = function() local startDate = wikidata.formatAndCat{entity = item, property = 'P2031', conjtype = 'or', sorttype = 'chronological'} local endDate = wikidata.formatAndCat{entity = item, property = 'P2032', conjtype = 'or', sorttype = 'chronological'} if not (startDate or endDate) then return wikidata.formatAndCat{entity = item, property = 'P1317'} end return complexdate.daterange(startDate, endDate, {precision = 11}) end } end function p.placeofburial() return {type = 'row', label = 'مكان الدفن', value = 'مدفن', wikidata = {property = "P119", showdate = true}} end function p.nationality() -- à améliorer étant donnée les moeurs Wikidata comme nationalité : Empire allemand (1901-1918) République de Weimar (1918-1933) local function wdDate() local nation = require 'Module:Country data'.nationality -- désactivation si date de naissance avant l'Ère contemporaine : trop d'imprécisions et d'anachronismes local mindate = '1789' local birthdate = wikidata.formatStatements{entity = item, property = 'P569', displayformat = 'raw', numval = 1} if (not birthdate) or complexdate.before(mindate, birthdate) then return nil end return { property = 'P27', -- vals = statements, -- statments est une variable non déclarée dans ce module showdate = true, entity = item, conjtype = 'new line', removedupes = true, linktopic = '-', displayformat = function(snak) local g = gender -- genre de la personne, pour affichage du gentilé if g == '?' then -- si inconnu, au masculin g = 'm' end local val, success = nation(wikidata.getId(snak), g,birthdate) if not success then val = wikidata.formatSnak(snak) end return val end } end return { type = 'row', label = 'الجنسية', plurallabel = 'الجنسيات', value = {'جنسية','الجنسية','nationality','nationalité'}, wikidata = wdDate() -- wdDate() retourne une table } end function p.nativelanguage() return {type = 'row', label = '[[لغة أم|اللغة الأم]]', value = {'اللغة الأم','اللغة_الأم','first language','langue maternelle'}, property = 'P103'} end -- Domiciles function p.places() return {type = 'multi', rows = { { type = 'row', label = 'Dème', plurallabel = 'Dèmes', value = 'dème', wikidata = {property = 'P2462', showdate = true, sorttype= 'chronological', precision = 'year'}, }, { type = 'row', label = 'الإقامة', --plurallabel = 'الإقامة', value = {'إقامة','الإقامة','residence','domicile'}, wikidata = {property = 'P551', showdate = true, sorttype= 'chronological', precision = 'year'}, }, }} end -- parcours professionel function p.education() -- à améliorer local query = {sorttype= 'chronological', property = 'P69', showdate = true, showqualifiers = 'P512', conjtype = '*', linktopic = '-'} return { type = 'row', value = {'المدرسة الأم','alma_mater','éducation', 'formation'}, wikidata = query, label = '[[مدرسة أم|المدرسة الأم]]', } end function p.occupation() local speciallabels = { f = { ['Q33999'] = '[[ممثلة]]', ['Q10798782'] = '[[ممثلة]]', ['Q10800557'] = '[[ممثلة]]', ['Q2405480'] = '[[ممثلة]]', ['Q2259451'] = '[[ممثلة]]', ['Q948329'] = '[[ممثلة]]' }, m = { ['Q33999'] = '[[ممثل]]', ['Q10798782'] = '[[ممثل]]', ['Q10800557'] = '[[ممثل]]', ['Q10798782'] = '[[ممثل]]', ['Q2405480'] = '[[ممثل]]', ['Q2259451'] = '[[ممثل]]', ['Q948329'] = '[[ممثل]]' } } return { type = 'row', value = {'مهنة', 'مهن'}, wikidata = { property = 'P106', defaultlink = '-', defaultlinkquery = {property = 'P425'}, labelformat = function(id) return genderedlabel(id) end, speciallabels = speciallabels[gender] or speciallabels['m'], removedupes = true, excludevalues = { -- les occupations qui ne méritent pas d'être affichées 'Q482980', -- auteur --'Q15980158', "auteur de non-fiction" a depuis été traduit par "essayiste" 'Q18814623', -- autobiographe 'Q1209498', -- juriste-poète } }, label = 'المهنة', --plurallabel = 'المهن' } end function p.employer() return { type = 'row', value = 'عمل عند', wikidata = {property = 'P108', showdate = true, sorttype= 'chronological'}, label = 'عمل عند', } end function p.victories() local title, singtitle = 'الانتصارات', 'انتصار' local localparam = 'victoire' local wdconf = {property = 'P2522'} local displayformat = 'B' return timeline(localparam, wdconf, displayformat, title, singtitle) end function p.officialposition() local title, singtitle = 'المناصب', 'المنصب' local localparam = 'منصب' local wdconf = { property = 'P39', rank = 'valid', sorttype = 'inverted', defaultlinkquery = {property = {'P2354', 'P2389', 'P453', 'P361', 'P108'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de", "partie de", employeur } -- sur une ligne séparée : juridiction, "de", circonsription, diocèse, affiliation, assemblée, parti, emmloyeur local details = function(statement) return wikidata.getFormattedQualifiers(statement, {'P1001', 'P642', 'P768', 'P708', 'P1416', 'P194', 'P108', 'P937'}) end local displayformat = 'C' return timeline(localparam, wdconf, displayformat, title, singtitle, details) end function p.nobilitytitle() local title, singtitle = 'ألقاب النبلاء', 'لقب نبيل' local localparam = 'لقب نبيل' local wdconf = { property = 'P97', entity = item, rank = 'valid', showqualifiers = {'P642'}, defaultlinkquery = {property = {'P2354', 'P361'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de" et "partie de" } local displayformat = 'B' return timeline(localparam, wdconf, displayformat, title, singtitle) end function p.honorifictitle() title, singtitle = 'ألقاب شرفية', 'لقب شرفي' local localparam = 'لقب شرفي' local wdconf = {property = 'P511', entity = item, rank = 'valid'} local displayformat = 'C' return timeline(localparam, wdconf, displayformat, title, singtitle) end function p.tombe() return { type = 'images', imageparameters = {'قبر','tombe'}, defaultimages = nil, defaultupright = 1, uprightparameter = 'upright tombe', sizeparameter = 'taille tombe', -- obsolète captionparameter = 'تعليق القبر', defaultcaption = 'صورة للقبر', property = 'P1442', numval = 1, } end function p.plaque() return { type = 'images', imageparameters = {'plaque','لوحة تذكارية'}, defaultimages = nil, defaultupright = 1, uprightparameter = 'upright plaque', sizeparameter = 'taille plaque', -- obsolète captionparameter = 'تعليق لوحة تذكارية', defaultcaption = 'لوحة تذكارية', property = 'P1801', numval = 1, } end function p.blason() return { type = 'images', imageparameters = {'blason','شعار النبالة','coat'}, defaultimages = nil, defaultupright = 0.5, uprightparameter = 'upright blason', sizeparameter = 'taille blason', -- obsolète captionparameter = 'تعليق شعار النبالة', defaultcaption = 'شعار النبالة', property = 'P94', numval = 1, } end function p.sceau() return { type = 'images', imageparameters = {'sceau','ختم','seal'}, defaultimages = nil, defaultupright = 0.7, uprightparameter = 'upright sceau', sizeparameter = 'taille sceau', -- obsolète captionparameter = 'تعليق الختم', defaultcaption = 'الختم', property = 'P158', numval = 1, } end function p.monogram() return { type = 'images', imageparameters = {'monogramme','مونغرام','monogram'}, defaultimages = nil, defaultsize = '100px', sizeparameter = 'taille monogramme', captionparameter = 'تعليق المونغرام', defaultcaption = 'المونغرام', property = 'P1543', numval = 1, } end function p.flag() return { type = 'images', imageparameters = {'drapeau','flag','علم'}, defaultimages = nil, defaultsize = '150px', sizeparameter = 'حجم العلم', captionparameter = 'تعليق العلم', defaultcaption = 'العلم', property = 'P41', numval = 1, } end function p.logo() return { type = 'images', imageparameters = {'logo','شعار'}, defaultimages = nil, defaultsize = '150px', sizeparameter = 'حجم الشعار', captionparameter = 'تعليق الشعار', defaultcaption = 'الشعار', property = 'P154', numval = 1, } end function p.politicalparty() return { type = 'row', value = {'الحزب','الحزب السياسي','party','parti politique'}, label = '[[حزب سياسي|الحزب السياسي]]', plurallabel = 'الأحزاب السياسية', wikidata = { property = 'P102', sorttype= 'chronological', showdate = true, conjtype = 'new line', excludespecial = true}, } end function p.memberof() return {type = 'multi', rows = { { type = 'row', value = 'ordre de chevalerie', label = 'Ordre de chevalerie', plurallabel = 'Ordres de chevalerie', wikidata = {property = 'P550', sorttype= 'chronological', showdate = true}, }, { type = 'row', label = 'عضو في', value = {'عضو','عضو في','عضوية','member of','membre de'}, wikidata = {property = 'P463', sorttype= 'chronological', showdate = true, precision = 'year', textformat = 'minimum', conjtype = 'new line'}, }, }} end function p.awards() local function awardsList() local majorawards = require 'وحدة:قاموس ويكي بيانات/جوائز' local query = { entity = item, property= 'P166', sorttype= 'chronological', grouped = true, showqualifiers = 'P642', showdate= true, precision = 'year', conjtype = 'new line', textformat = 'minimum', linktopic = '-', defaultlinkquery = {property = {'P2354', 'P361' , 'P1027'}}, excludevalues = majorawards.exclude, -- membre de la Royal Society, redondance avec le champ « membre de » (P463) speciallabels = majorawards, labelformat = function(id) return genderedlabel(id) end, } local claims = wikidata.getClaims(query) if (not claims) then return nil end local str = wikidata.formatAndCat(query) if #claims < 4 then return str, #claims end --si trop de valeurs, n'afficher que les importantes de [[Module:Dictionnaire Wikidata/Distinctions]], et mettre les autrs dans un menu pliant --- récupération des importantes local majorStr local targetvalues = {} for i, j in pairs(majorawards) do table.insert(targetvalues, i) end query.targetvalue = targetvalues query.value, query.claims, query.valuetable = nil, nil, nil -- apparemment sinon ce n'est pas le cas, pourquoi ? BUG IMPORTANT majorStr = wikidata.formatAndCat(query) --- repliage des autres local message = "'''القائمة'''" --[[local allAwardsTable = mw.html.create('div') :addClass('toccolours mw-collapsible mw-collapsed') :wikitext(message) :css{border = 'none'} :tag('div') :addClass('mw-collapsible-content') :css{['line-height'] = '150%'} -- sinon c'est vraiment serré :wikitext( str) :done() :allDone()]]-- allAwardsTable = mw.html.create('div') :attr({class="NavContent", style="display: none; text-align: center;"}) :css{['line-height'] = '150%'} -- sinon c'est vraiment serré :wikitext( str) :done() local divNavHead = mw.html.create('div') :attr({class="NavHead", style="text-align:left;border: none; padding: 0; background:none"}) :wikitext(message .." [عرض]/[إخفاء]") allAwardsTable = mw.html.create('div') :attr({class="NavFrame", style="border: none; padding: 0;"}) :node(divNavHead) :node(allAwardsTable) :allDone() return -- linguistic.conj({majorStr, tostring(allAwardsTable)}, '<br>'), #claims linguistic.conj({majorStr, str}, '<br>'), #claims end return --{type='table', title = 'الجوائز', rows = { { type = 'row', value = {'جوائز','الجوائز','awards','الأوسمة','أوسمة'}, label = 'الجوائز', singularlabel = 'الجائزة', hidden = true, wikidata = function() return awardsList() end } --}} end -- Influences function p.influencedby() return { type = 'row', label = function(localdata, item) if gender == 'f' then return 'تأثرت بـ' elseif gender == 'm' then return 'تأثر بـ' else return 'تأثر بـ' end end, value = {'تأثر','influences','تأثر بـ','influencé par'}, wikidata = {property = 'P737'}, } end function p.influenced() return { type = 'row', label = function(localdata, item) if gender == 'f' then return 'أثرت في' elseif gender == 'm' then return 'أثر في' else return 'أثر في' end end, value = {'تأثير','influenced','أثر في','a influencé', 'influence de'}, } end -- Appartenances function p.movement() return { type = 'row', label = 'الحركة', value = {'التيار','movement','الحركة'}, wikidata = {property = 'P135', sorttype= 'chronological', showdate = true, precision = 'year'}, } end -- الديانة function p.religion() return {type = 'multi', rows = { { type = 'row', label = '[[دين (معتقد)|الديانة]]', plurallabel = '[[دين (معتقد)|الديانات]]', value = {'الديانة','الدين','دين','religion'}, wikidata = {property = 'P140', sorttype= 'chronological', showdate = true, precision = 'year', excludevalues = 'Q7066'}, }, { type = 'row', label = 'تاريخ المعمودية', value = 'تاريخ المعمودية', property = 'P1636', }, { type = 'row', label = 'العراب', plurallabel = 'العرابون', value = 'عراب', property = 'P1290', }, { type = 'row', label = 'الاسم الديني', plurallabel = 'الاسماء الدينية', value = 'اسم ديني', property = 'P1635',}, { type = 'row', label = 'النظام الديني', plurallabel = 'الأنظمة الدينية', value = 'نظام ديني', property = 'P611',}, { type = 'row', label = 'المُقدِّس', plurallabel = 'المُقدِّسون', value = 'مقدس', property = 'P1598'}, { type = 'row', label = function(localdata, item) if gender == 'f' then return 'يعظمها' elseif gender == 'm' then return 'يعظمه' else return 'يعظمه' end end, value = 'يعظمه', property = 'P1049', }, { type = 'row', label = 'رتبة التقديس', value = 'رتبة التقديس', wikidata = { property = 'P411', labelformat = function(id) return genderedlabel(id) end, }, }, }} end -- التاريخ العسكري function p.military() return {type = 'multi', rows = { { type = 'row', label = 'السلاح', plurallabel = 'الأسلحة', value = {'arme','سلاح'}, wikidata = {property = 'P241', showdate = true, sorttype= 'chronological', precision = 'year'}, }, { type = 'row', label = 'الرتبة العسكرية', plurallabel = 'الرتب العسكرية', value = 'رتبة عسكرية', --wikidata = {property = 'P410', showdate = true, sorttype= 'chronological', precision = 'year', speciallabels = militaryranks, conjtype ='new line'}, }, { type = 'row', label = 'النزاع', plurallabel = 'النزاعات', value = 'نزاع', wikidata = {property = 'P607', conjtype = 'new line', showdate = true, sorttype= 'chronological', precision = 'year'}, }, }} end -- Carrière de torero function p.torero() return {type = 'multi', rows = { { type = 'row', label = 'Alternative', value = 'alternative', wikidata = function() return wikidata.keyDate('Q2840411', item) end }, { type = 'row', label = "Confirmation d'alternative", value = 'confirmation alt', wikidata = function() return wikidata.keyDate('Q23308805', item) end }, }} end -- الرياضة function p.sport() return {type = 'multi', rows = { { type = 'row', label = 'التخصص', plurallabel = 'التخصصات', value = 'تخصص', wikidata = {property = 'P413', labelformat = function(id) return genderedlabel(id) end, }, }, { type = 'row', label = 'الرياضة', plurallabel = 'الرياضات', value = 'رياضة', wikidata = {property = 'P2416'}, }, { type = 'row', label = 'يد اللعب', value = 'يد اللعب', wikidata = {property = 'P741'}, }, { type = 'row', label = 'يقذف بـ', value = 'يقذف', wikidata = {property = 'P423'}, }, { type = 'row', label = 'أول فريق', --plurallabel = 'Repêchages par', value = 'أول فريق', wikidata = { property = 'P647', statementformat = function(statement) local team = wikidata.formatStatement(statement) local moment = wikidata.getFormattedQualifiers(statement, {'P793'}) or wikidata.getFormattedQualifiers(statement, {'P585'}) local rank = wikidata.getFormattedQualifiers(statement, {'P1836'}) if rank then rank = 'الاختيار ' .. rank end local qualifs = linguistic.conj({moment, rank}, ' – ') if not qualifs then return team end return team .. ' <small>(' .. qualifs .. ')</small>' end }, }, { type = 'row', label = 'الفريق', plurallabel = 'الفرق', value = 'فريق', wikidata = { property = 'P54', sorttype= 'chronological', conjtype = '*', statementformat = function(statement) local str = wikidata.formatStatement(statement, {showdate = true}) local compets = wikidata.getFormattedQualifiers(statement, {'P1350'}) compets = nbr_in_arabic(compte,'مباراة','مباراتان','مباريات') local points = wikidata.getFormattedQualifiers(statement, {'P1351'}) points =nbr_in_arabic(points,'نقطة مسجلة','نقطتان مسجلتان',"نقاط مسجلة") local qualifiers = linguistic.conj{compets, points} if qualifiers then str= str .. ' <small> – ' .. qualifiers .. ' </small>' end return str end } }, { type = 'row', label = 'مباريات المنتخب الوطني', value = 'مباريات المنتخب', wikidata = {property = 'P1129', numval = 1}, }, { type = 'row', label = 'ألقاب في الشطرنج', --plurallabel = 'Titres aux échecs', value = 'ألقاب في الشطرنج', wikidata = {property = 'P2962', sorttype= 'chronological', showdate = true, precision = 'year'}, }, { type = 'row', label = 'تصنيف إيلو', value = 'تصنيف إيلو', wikidata = {property = 'P1087', numval = '3', sorttype = 'inverted', conjtype = 'new line', showdate = true, precision = 'month', removedupes = true}, }, { type = 'row', label = 'الأرقام المحطمة', --plurallabel = 'Records détenus', value = 'أرقام محطمة', wikidata = {property = 'P1000', sorttype= 'chronological', showdate = true}, }, { type = 'row', label = 'المدرب', plurallabel = 'المدربون', value = 'مدرب', wikidata = {property = 'P286', sorttype= 'chronological', showdate = true, precision = 'year'}, }, { type = 'row', label = 'السائق المساعد', --plurallabel = 'Copilotes', value = 'سائق مساعد', wikidata = {property = 'P2095', sorttype= 'chronological', showdate = true, precision = 'year'}, }, { type = 'row', label = '[[رعاية تجارية|الراعي]]', --plurallabel = 'Sponsors', value = 'راعي', wikidata = {property = 'P859', sorttype= 'chronological', showdate = true, precision = 'year'}, }, }} end -- أسخاص على علاقة function p.contacts() return {type = 'multi', rows = { { type = 'row', label = localdata['درس عند'] or 'درس عند', --plurallabel = 'Maîtres', value = {'مدرس', 'مدرسون'}, wikidata = {property = 'P1066', sorttype= 'chronological', showdate = true, precision = 'year'}, }, { type = 'row', label = 'المشرف على الرسالة', --plurallabel = 'Directeurs de thèse', value = 'مشرف على الرسالة', wikidata = {property = 'P184', sorttype= 'chronological', showdate = true, precision = 'year'}, }, { type = 'row', label ="الموكل" , value = 'موكل', wikidata = {property = 'P1875'}, }, { type = 'row', label = 'الشريك', plurallabel = 'الشركاء', value = 'شريك', wikidata = {property = 'P1327'}, }, { type = 'row', label = 'شخص هام', --plurallabel = 'Personnes liées', value = 'شخص هام', wikidata = {property = 'P3342', numval = 5, showqualifiers = 'P794'}, }, }} end -- Mécénat function p.patron() return { type = 'row', label = 'الراعي', --singularlabel = '[[Mécénat|Mécène]]', --plurallabel = '[[Mécénat|Mécènes]]', value = 'راعي', wikidata = {property = 'P859', showdate = true, sorttype = 'chronological', conjtype = 'comma'}, } end -- موسيقى function p.music() return {type = 'multi', rows = { { type = 'row', label = 'الطبقة الصوتية', value = 'طبقة صوتية', property = 'P412', }, { type = 'row', label = 'التخصص الصوتي', value = 'تخصص صوتي', property = 'P1731', }, { type = 'row', label = 'عازف على', plurallabel = 'آلات', value = 'آلات', wikidata = {property = 'P1303', sorttype= 'chronological'}, }, { type = 'row', label = 'شركة التسجيلات', plurallabel = 'شركات التسجيلات', value = 'شركة التسجيلات', wikidata = {property = 'P264', sorttype= 'chronological', showdate = true, precision = 'year'}, }, }} end -- ضحايا function p.victims() return {type = 'multi', rows = { { type = 'row', label = 'الضحايا', value = 'ضحايا', wikidata = {property = 'P1345'},}, }} end -- الأحكام القضائية function p.penalties() return {type = 'multi', rows = { { type = 'row', label = function(localdata, item) if gender == 'f' then return 'حكم عليها لـ' elseif gender == 'm' then return 'حكم عليه لـ' else return 'حكم عليه لـ' end end, value = 'حكم عليه لـ', wikidata = {property = 'P1399', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'}, }, { type = 'row', label = 'الأحكام', plurallabel = 'الأحكام', value = 'حكم', wikidata = {property = 'P1596', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'}, }, { type = 'row', label = 'مكان السجن', plurallabel = 'أمكنة السجن', value = 'سجن', wikidata = {property = 'P2632', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'}, }, }} end -- أبعاد جسمانية function p.appearance() return {type = 'multi', rows = { { type = 'row', label = 'الطول', value = 'طول', wikidata = {property = 'P2048', targetunit = 'metre', rounding = '2'}, }, { type = 'row', label = 'الوزن', value = 'وزن', wikidata = {property = 'P2067', targetunit = 'kilogram', rounding = '1'}, }, { type = 'row', label = 'الشعر', value = 'شعر', wikidata = {property = 'P1884'}, }, { type = 'row', label = 'العيون', value = 'عيون', wikidata = {property = 'P1340'}, }, }} end -- العائلة function p.family() return {type = 'multi', rows = { { type = 'row', label = 'العائلة', plurallabels = 'العائلات', value = 'عائلة', property = 'P53',}, { type = 'row', label = 'الأب', value = 'أب', wikidata = {property = 'P22', conjtype = ' أو '},}, { type = 'row', label = 'الأم', value = 'أم', wikidata = {property = 'P25', conjtype = ' ou '},}, { type = 'row', label = 'الصهر', plurallabel = 'الأصهار', value = {'صهر'}, property = 'P3448',}, { type = 'row', label = 'الإخوة', value = 'إخوة', wikidata = { property = 'P3373', sorttype = 'chronological', conjtype = 'new line', textformat = 'long', precision = 'year', stilltrue = not dead, }}, { type = 'row', label = --'الزوج', -- todo : adapter le libellé en genre ? function(localdata, item) if gender == 'f' then return 'الزوج' elseif gender == 'm' then return 'الزوجة' else return 'الزوج' end end, plurallabel = --'الأزواج', function(localdata, item) if gender == 'f' then return 'الأزواج' elseif gender == 'm' then return 'الزوجات' else return 'الزوجات' end end, value = 'زوج', wikidata = { property = 'P26', showdate = true, sorttype = 'chronological', conjtype = 'new line', textformat = 'long', precision = 'year', stilltrue = not dead, precision = 'year', } }, { type = 'row', label = 'الإبن',-- todo : adapter le libellé en genre ? plurallabel = 'الأبناء', value = 'إبن', wikidata = { property = 'P40', conjtype = 'new line', showdate = false, sorttype = 'order', textformat = 'long', precision = 'year', stilltrue = not dead, precision = 'year', } }, { type = 'row', label = 'الأقارب', value = 'أقارب', wikidata = { property = 'P1038', excludespecial = true, conjtype = 'new line', statementformat = function(statement) local personid = wikidata.getMainId(statement) local personlabel = wikidata.formatEntity(personid) local persongender = getgender(personid) local kintype = wikidata.getFormattedQualifiers( statement, 'P1039', { labelformat = function(id) return '<small>'..genderedlabel(id, persongender)..'</small>' end, link = '-' } ) if kintype then return personlabel .. ' ' .. linguistic.inparentheses(kintype) end return personlabel end, } }, }} end -- الرق function p.slavery() return {type = 'multi', rows = { { type = 'row', label = 'عبد/حر', value = 'عبد حر', wikidata = {property = 'P3716', showdate = true, defaultlinkquery = 'P425'}, }, { type = 'row', label = 'المالك', plurallabels = 'الملاك', value = 'مالك', property = 'P127', }, }} end -- الأعمال function p.works(params) params = params or {} local title = params.title or 'أهم الأعمال' params.title = nil local wikidata = { excludespecial = true, numval = 5, property = 'P800', defaultlink = 'image', showdate= true, labelformat = function(id) local label = wikidata.getLabel(id) if label then return '<i>' .. label .. '</i>' end end, } for i, j in pairs(params) do wikidata[i] = j end return {type = 'table', title = title, singulartitle = singulartitle, rows = { { type = 'row', value = 'أهم الأعمال', wikidata = wikidata } } } end function p.filmography() local title = 'أشهر الأفلام' return {type = 'row', label = 'أشهر الأفلام', value = 'أشهر الأفلام', property = 'P1283'} end function p.discography() local title = 'أشهر الأغاني' return {type = 'row', label = 'أشهر الأغاني', value = 'أشهر الأغاني', property = 'P358'} end -- التوقيع function p.signature(default) local nom = localdata.nom or mw.title.getCurrentTitle().text local alt = 'توقيع ' .. nom return { type = 'images', imageparameters = {'توقيع','signature'}, defaultimage = default, captionparameter = 'تعليق التوقيع', defaultcaption = 'التوقيع', uprightparameter = 'upright signature', defaultupright = 0.5, defaultalt = alt, property = 'P109', numval = 1 } end -- تسجيل صوتي function p.voice() return { type = 'images', style = {['padding-top'] = '25px'},--{['border-width'] = '10px', ['border-style'] = 'solid'}, defaultcaption = 'تسجيل صوتي', captionparameter = 'تعليق الصوت', value = 'صوت', defaultsize = '280', wikidata = general.selectSound('P990'), numval = 1, } end -- موقع الويب p.website = general.website -- التلفظ p.prononciation = general.prononciation return p