Documentation icon دستاویز [تخلیق]
local p = {}

function p.office3( statement , options) -- used by سانچہ:معلومات صاحب منصب/منصب ويكي بيانات
		local value = statement.mainsnak.datavalue.value
   		local entit = getEntityIdFromValue( value )
    	local s = formatSnak( statement.mainsnak, options ).value

		if s then
		        local entit = getEntityIdFromValue( value )
        		local ca1 = formatStatements( {property ='P154', entityId = entit
        			, noref ='true' ,rank='all'	,size ='35',image ='image',enbarten ='true',separator='',conjunction=''})
        		local ca2 = formatStatements( {property ='P41', entityId = entit
        			, noref ='true' ,rank='all'	,size ='35',image ='image',enbarten ='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
				reff  = formatReferences( statement, options )
				s = s..reff
			end 
		end
		----------
		function qua(property, enbarten, modifytime)
			ca = formatStatements({property = property, enbarten = enbarten ,modifytime = modifytime}, statement.qualifiers) or ''
			if ca and ca ~='' 
			then
				return addTrackingCategory(ca ,{property=property,noicon='t'})
			else 
				return ca
			end
		end
		----------
		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", '', '')
					P2937= qua("P2937", '', '')
			end
		end
		if options.office2 and options.office2 ~= '' then
							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
						, entityId		= options.entityId
						}
					} 
				end
	
	end
	 return s 
end

return p