Modulo:Wikidata: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m fix apice |
+getEntityCached per Speciale:Permalink/93094114#Problema_lentezza_mw.wikibase.getEntity |
||
Riga 47:
}
}
-- Table per la funzione getEntityCached
local entitiesCache = {}
local p = {}
Riga 382 ⟶ 385:
-- Lettura e selezione statement
-------------------------------------------------------------------------------
-- Versione con cache di mw.wikibase.getEntity
local function getEntityCached(entityId)
local ret
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage()
if entityId then
ret = entitiesCache[entityId]
if not ret then
ret = mw.wikibase.getEntity(entityId)
if ret then
entitiesCache[entityId] = ret
end
end
end
return ret
end
-- Restituisce true se lo statement contiene il qualifier richiesto con un dato valore
Riga 417 ⟶ 436:
-- get entity
entity =
if not entity then
return nil
Riga 656 ⟶ 675:
-- Restituisce l'etichetta di un item o di una proprietà Wikidata.
function p._getLabel(args)
local entity =
return entity and entity:getLabel(args[2])
end
Riga 681 ⟶ 700:
end
entity =
if not entity then
error(i18n.errors['entity-not-found'], 2)
|