Modulo:Interprogetto/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
disabilito il controllo della proprietà per la categoria quando già l'interlink è una categoria
aggiungo funzione getClaim e controllo della proprietà P935
Riga 121:
if self.entity then
return self.entity:getLabel(label)
else
return nil
end
end
 
function Wikidata_entity:getClaim(property_id)
and if self.entity.claims[property_id] and
and self.entity.claims[property_id][1].mainsnak and
and self.entity.claims[property_id][1].mainsnak.datavalue.type == 'string' then
andreturn self.entity.claims[property_id][1].mainsnak.datavalue.value
else
return nil
Line 138 ⟶ 148:
self.from_property_category[key_progetto] = false
end
local claim
if progetto.property_category and self.from_property_category[key_progetto] ~= false then
local property_idclaim = self:getClaim(progetto.property_category)
if self.entity.claimsclaim then
self.collegamenti[key_progetto] = 'Category:' .. self.entity.claims[property_id][1].mainsnak.datavalue.valueclaim
and self.entity.claims[property_id]
and self.entity.claimsfrom_property_category[property_id][1key_progetto] = true
and self.entity.claims[property_id][1].mainsnak
and self.entity.claims[property_id][1].mainsnak.datavalue
and self.entity.claims[property_id][1].mainsnak.datavalue.type == 'string' then
self.collegamenti[key_progetto] = 'Category:' .. self.entity.claims[property_id][1].mainsnak.datavalue.value
self.from_property_category[key_progetto] = true
end
end
Line 168 ⟶ 174:
self.badge[key_progetto].class = table.concat(badge_class, ' ' )
self.badge[key_progetto].title = table.concat(badge_title, ', ' )
end
elseif not self.is_category and progetto.property_gallery and not self.from_property_category[key_progetto] then
claim = self:getClaim(progetto.property_gallery)
if claim then
self.from_property_categorycollegamenti[key_progetto] = trueclaim
end
end
Line 420 ⟶ 431:
local article_link
-- recupera il collegamento automatico alla voce (può essere in entity.article_link[key_progetto] o
-- in entity.collegamento[key_progetto] a seconda del sitelink e della proprietà per lale categoriacategorie)
if entity.from_property_category[key_progetto] then
article_link = entity.article_link[key_progetto]