Modulo:Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m fix apice |
+getEntityCached |
||
Riga 382:
-- Lettura e selezione statement
-------------------------------------------------------------------------------
-- Table per la funzione getEntityCached
local entities = {}
-- Versione con cache di mw.wikibase.getEntity
local function getEntityCached(entityId)
local ret
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage()
if entityId then
ret = entities[entityId]
if not ret then
ret = mw.wikibase.getEntity(entityId)
if ret then
entities[entityId] = ret
end
end
end
return ret
end
-- Restituisce true se lo statement contiene il qualifier richiesto con un dato valore
Line 417 ⟶ 436:
-- get entity
entity =
if not entity then
return nil
Line 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
Line 681 ⟶ 700:
end
entity =
if not entity then
error(i18n.errors['entity-not-found'], 2)
|