وحدة:Wikidata2/P39

من أرابيكا، الموسوعة الحرة
اذهب إلى التنقل اذهب إلى البحث

local p = {}

function p.office3( statement , options) -- used by قالب:معلومات صاحب منصب/منصب ويكي بيانات
		local value = statement.mainsnak.datavalue.value
		local start , finish , before , after , constituency , series ,electedin ,P1001 ,P108 ,P642 ,president ,premier , p5054 , P2937 = ""
   		local entit = value.id
    	local s = formatSnak( statement.mainsnak, options ).value
		if s then
		        local entit = value.id
        		local ca1 = formatStatements( {property ='P154', entityId = entit
        			, noref ='true' ,rank='all'	,size ='35',image ='image', firstvalue='true',separator='',conjunction=''})
        		local ca2 = formatStatements( {property ='P41', entityId = entit
        			, noref ='true' ,rank='all'	,size ='35',image ='image', firstvalue='true',separator='',conjunction=''})
        		if ca1 and ca1 ~= '' then  caca  =  ca1  else  caca  = ca2 end

        		local asdf = formatEntityId( entit , options ).value
        			if asdf and asdf  ~= '' then
        		if caca and caca  ~= '' then  s =  caca .. ' '.. asdf   else  s = asdf   end
				end
		if statement.references then
			if options.reff and options.reff ~= ''  then
				local reff  = formatReferences( statement, options )
				s = s..reff
			end 
		end
		----------
		local function qua(property, enbarten, modifytime)
			local ca = formatStatements({property = property,illwd2= "t" ,  firstvalue= enbarten ,modifytime = modifytime}, statement.qualifiers) or ''
			if ca and ca ~=''  then
				return ca .. addTrackingCategory({property=property,noicon='t'})
			else 
				return ca
			end
		end
		----------
	--if options.office2 and options.office2 ~= '' then
		if statement.qualifiers
			then
				if statement.qualifiers.P580 or statement.qualifiers.P582 or statement.qualifiers.P1365 or statement.qualifiers.P1366 
				then
					start	=	qua("P580", 'true', 'longdate')
					finish	=	qua("P582", 'true', 'longdate')
					before	=	qua("P1365", 'true', '')
					after	=	qua("P1366", 'true', '')
					constituency	=	qua("P768", '', '')
					series	=	qua("P1545", 'true', '')
					electedin	=qua("P2715", '', '')
					P1001	=	qua("P1001", '', '')
					P108	=	qua("P108", '', '')
					P642 = qua("P642", '', '')
					president = qua("P325", '', '')
					premier= qua("P6", '', '')
					p5054= qua("P5054", '', '')
					P2937= qua("P2937", '', '')
			end
				--if entit == "Q140686" and not P642 or P642 == "" then return s end
			end
		end
	s = mw.getCurrentFrame():expandTemplate{ title = "معلومات صاحب منصب/منصب ويكي بيانات/نواة"	, 
	args = {
		  office 		= s
		, termstart 	= start
		, termend 		= finish
		, constituency 	= constituency
		, predecessor	= before
		, successor 	= after
		, president		= president
		, premier 		= premier
		, series		= series
		, electedin		= electedin
		, jurisdiction	= P1001
		, employer		= P108
		, of			= P642
		, P2937			=  P2937
		, q = entit
		, P5054 = p5054
		, entityId		= options.entityId
		, co		= options.co
		}
	} 
	--end
	return s 
end

return p