انتقل إلى المحتوى

وحدة:Wikidata2/awards

من ويكيبيديا، الموسوعة الحرة

local p = {}

local function valid_v(x)
	if x and x ~= "" then return x end
	return nil
end

function p.awards(datavalue, datatype, options) -- used by template:ص.م/سطر جوائز ويكي بيانات
	if datatype ~= 'wikibase-item'
	then
		return ''
	end
	local value = datavalue.value
	local image = formatStatements({ pid = 'P2425', qid = value.id, size = '30', image = 'yes', noref = 'true', firstvalue = 'true' })
	local categoryid = formatStatements({ pid = 'P2517', qid = value.id, noref = 'true', firstvalue = 'true', formatting = 'raw' })
	--[[
	if not valid_v(categoryid) then
		categoryid = formatStatements({ pid = 'P910', qid = value.id, noref = 'true', firstvalue = 'true', formatting = 'raw' })
	end
	if not valid_v(image) then
		image = formatStatements({ pid = 'P154', qid = value.id, size = '30', image = 'yes', noref = 'true', firstvalue = 'true' })
	end
	]]
	local category = mw.wikibase.sitelink(categoryid)
	local s = formatEntityId(value.id, options).value
	if valid_v(s) then
		if valid_v(image) then
			s = image .. ' ' .. s
		end
		if valid_v(category) then
			s = s .. ' [[' .. category .. ']]'
		end
	end
	return s
end

return p
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy