Modulo:Wikidata: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m ottimizzazione
m new fix
Riga 422:
-- Entry-point per {{#invoke:Wikidata|checkStatements}}
function p.checkStatements(frame)
local entity, property, value, formattingcheckvalue
 
property = frame.args.property and string.upper(frame.args.property)
value = frame.args.value and string.upper(frame.args.value)
formatting = frame.args.formatting
 
if not property then
Line 435 ⟶ 434:
if entity and entity.claims and entity.claims[property] then
local claims = entity.claims[property]
for _n, claim in pairs(claims) do
if claim and claim.mainsnak and claim.mainsnak.datavalue then
local datavalue = formatDatavalue(claim.mainsnak.datavalue, options, formatting)
local options = { formatting = 'nolink' }
-- controllo tramite identificatore per tipo di dato "elemento"
local datavalue = formatDatavalue(claim.mainsnak.datavalue, options, formatting)
if string.upper(datavalue).type == value'wikibase-entityid' then
checkvalue = formatEntityId(getEntityIdFromValue(datavalue.value), options, 'raw')
return true
if checkvalue == string.upper(value) then
return n
end
end
-- controllo testuale tra stringhe
checkvalue = formatDatavalue(datavalue, options)
if tostring(checkvalue) == value then
return truen
end
end