Module:Data

local p = {}

function p.claimLabels( prop, claim ) local labels = '' for index, value in next, claim do		local datatype = value.mainsnak.datatype if datatype == 'wikibase-item' then local entity = mw.wikibase.getEntity(value.mainsnak.datavalue.value.id) local sitelink = entity:getSitelink local label = entity:getLabel if sitelink ~= nil then labels = labels ..  .. label ..  else labels = labels .. label end elseif datatype == 'external-id' then local externalid = value.mainsnak.datavalue.value local entity = mw.wikibase.getEntity( prop ) local formatterurl = entity.claims['P12'][1].mainsnak.datavalue.value local link = string.gsub(formatterurl, '$1', externalid) labels = labels .. '[' .. link .. ' Link]' else labels = labels .. 'Datatype not supported in Module:Data' end if index < #claim then labels = labels .. ' '		end end return labels end

return p