Modulo:Interprogetto/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
rifiniture
meglio
Riga 134:
local interwiki = { project }
if property_language and self.entity.claims and self.entity.claims[property_language] then
for i_, claim in ipairs(self.entity.claims[property_language]) do
if claim.mainsnak.datavalue.type == 'wikibase-entityid' then
local entityId = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
Riga 141:
local language_code = claims[1] and claims[1].mainsnak.datavalue.value
if language_code then
project = project:gsub('^%a%a', language_code)
table.insert(interwiki, language_code .. 'wikisource'project)
self.lingua[language_code .. 'wikisource'project] = language_code
end
end
Line 213 ⟶ 214:
function Wikidata_entity:hasPropertyValue(propertyId, values)
if self.entity.claims and self.entity.claims[propertyId] then
localfor claims_, =claim in ipairs(self.entity.claims[propertyId]) do
if claim and claim.mainsnak and claim.mainsnak.datavalue and claim.mainsnak.datavalue.value then
for _, claim in pairs(claims) do
if claim and claim.mainsnak and claim.mainsnak.datavalue and claim.mainsnak.datavalue.value then
local datavalue = claim.mainsnak.datavalue
if datavalue.type == 'wikibase-entityid' thenand
if datavalue.value['entity-type'] == 'item' thenand
if (type(values) == 'table' thenand values[tostring(datavalue.value['numeric-id'])]) or
ifvalues == values[tostring(datavalue.value['numeric-id'])] then
return true
end
elseif values == tostring(datavalue.value['numeric-id']) then
return true
end
end
end
end