وحدة:بطاقة/قالب/حيوان

-- Credits:
-- Original from  [[fr:Special:Permalink/221747498|fr:Module:Infobox/Animal]]
-- forked by وهراني @arwiki (ar:وحدة:بطاقة/قالب/حيوان)
-- Version: 20230705

local generic = require ("وحدة:بطاقة/أدوات")
local localdata = require  ('وحدة:بطاقة/بيانات' )

local person = require ('وحدة:بطاقة/أدوات/شخص')

local speciesformats = {
	--{espèce, espèce, couleur titre, couleur sous-titre, couleur texte, icône) doivent être classés du plus spécifique au plus général
	 Q144= {'Q144', 'chien', '#947151', '#B08660', '#000000', 'defaut'}, -- brun foncé
	 Q146= {'Q146', 'chat', '#474747', '#787878', '#FFFFFF', 'defaut'}, -- noir/gris
	 Q726= {'Q726', 'cheval', '#D2B48C', '#D2B48C', '#FFFFFF', 'defaut'}, -- brun clair (comme [[Modèle:Infobox Cheval]])
	 Q36341= {'Q36341', 'ours brun', '#8A5030', '#B37659', '#FFFFFF', 'defaut'}, -- brun soutenu
	 Q839769= {'Q839769', 'ours brun', '#8A5030', '#B37659', '#FFFFFF', 'defaut'}, -- brun soutenu
	 Q237260= {'Q237260', 'ours brun', '#8A5030', '#B37659', '#FFFFFF', 'defaut'}, -- brun soutenu
	
}

local function setformat() 
    local wd = require "Module:Wikidata.Ca"

	local wtypes = wd.claim{  property = 'P31', formatting = 'raw', separator='/·/'	}
    if wtypes then	wtypes = mw.text.split(wtypes, '/·/')	end

	--wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) 
	for i, item in pairs(wtypes or {}) do
		if speciesformats[item] then
			return speciesformats[item]
		end
	end
	return {'Q', '', '#DFDFDF', '#D9D9D9', '#000000', 'defaut'}
end

local function setcharte()
	local charte = localdata['charte']
	if charte then
		for i, j in pairs(speciesformats) do
			if j[2] == charte then
				return j
			end
		end
	end
	return setformat()
end
local personformat = setcharte()


return {
	maincolor = personformat[3],
	secondcolor = personformat[4],
	--thirdcolor = personformat[5],
	wikimod='Wikidata.Ca',
	
	description = "بطاقة تعريفية للحيوانات المشهورة",
	
	parts = {
		generic.title(),
		generic.mainimage(), 
		{type = 'table', title = "معلومات عامة", rows = {

			
			person.othernames(),
            {
                type = "row", 
                label = "نسبة الاسم إلى",
                value = {"سبب_تسمية", "namesake"},
                wikidata = {property = "P138"},
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            },
			{type = 'row', label = 'الأصل', value = {'أصل', "بلد أصلي"}, property = 'P495'},

			{type = 'row', label = 'تاريخ الولادة', value = {'تاريخ الولادة','birth_date'}, property = 'P569'},
			{type = 'row', label = 'مكان الولادة', value = {'مكان الولادة','birth_place'}, property = 'P19'},

			
			{type = 'row', label = 'مكان العيش', value = {'مكان العيش','residence'}, 
				wikidata = {property = 'P551', listrank='bestrank', showDate='true'}},
			{type = 'row', label = 'تاريخ الوفاة', value = {'تاريخ الوفاة','death_date'}, property = 'P570'},
			{type = 'row', label = 'مكان الوفاة', value = {'مكان الوفاة','death_place'}, property = 'P20'},
			{type = 'row', label = 'سبب الوفاة', value = {'سبب الوفاة','death cause'}, property = 'P509'},
			person.family(),
			person.occupation(),
			{type = 'row', 
				label = 'مجال النشاط', 
				value = {'نشاط','field of work'}, 
				wikidata = {property = 'P101'}
			},

            {type = 'row',
                 label = 'ظهر في',
				value = {'ظهر_في','present_in','appearance'},
				wikidata = {
                    property = 'P1441', formatting='table', qualifier1='P577', 
                    rowformat='* $1 $0$R0', rowsubformat1="$1:",
                    showDate='true'
                }
			},
		
			{
				type = "row",
				label = "المالك",
				plurallabel = "الملاك",
				value = {"مالك", "owner", "المالك"},
				wikidata = {
					 property = "P127",
					 conjunction="<br />",
					 showDate="true"
				}, 
				metadata = {
				 description = "",
				 option = "", 
				 type = "", 
				}
			},
			{
				type = 'row',  
				label = 'عمل عند',
				value = {'عمل عند','employer'},
				wikidata = {
					conjunction='<br />',
					property = 'P108', 
					showDate = 'true', sorttype= 'chronological'
				},
				metadata = {
					description = "الجهة الموظفة",
					option = "", 
					type = "",
				}
			},
			{
			  type = "row",
			  label = "أحداث مهمة",
			  value = {"أحداث", "تواريخ_مهمة", "significant_event", "events"},
			  wikidata = {property = "P793"}
			},

			person.awards(),
			generic.website(),
			{type = 'navbox', inner=true,
                previousparameter = {"سبقه","سابق","سابقه",'predecessor'}, 
                previousproperty = "P155",
                nextparameter = {"تبعه","لاحق","تاليه",'successor'},	
                nextproperty = "P156"
			},
		}},
		{type = 'table', title = 'بيانات بيولوجية', rows = {

			{type = 'row',
				label = '[[نوع (تصنيف)|نوع]]',
				value = {'نوع','species'},
				wikidata = {
					property = 'P10241', formatting ='table', rowformat="$0$R0"
					--targetclass = {"Q16521","Q55983715"}-- n'affiche que les "taxons" ou les "groupe d'organismes connu par un nom commun"
				} 
			},
			
			{type = 'row', 
				label = '[[سلالة (حيوانات أليفة)|السلالة]]', 
				value = {'سلالة','race'}, 
				wikidata = {property = 'P4743'}
			},
			{type = 'row',
				label = 'اللون',
				value = {'لون','color'},
				wikidata = {property = 'P462'},
				metadata = {
					description = "",
					option = "", 
					type = "",
				}
			},
			{type = 'row', label = 'الجنس', value = {'جنس','sex'}, property = 'P21'},

			{
				type = 'row',
				label = 'الطول',
				value = {'طول','height'},
				wikidata = {property = 'P2048', formatting='unitcode'},
				metadata = {
					description = "",
					option = "", 
					type = "",
				}
			},
			
			{
				type = 'row',
				label = 'الوزن',
				value = {'وزن','weight'},
				wikidata = {property = 'P2067', formatting='unitcode'},
				metadata = {
					description = "",
					option = "", 
					type = "",
				}
			},

		}},
		{type = 'table', title = 'الهوامش', rows = {
			{type = 'row1col',  value = {'هوامش','notes','footnotes'}},
		}},
	}
}

 

Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9

Portal di Ensiklopedia Dunia