Modulo:Wikidata: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m modulo no globals obsoleto |
m inverto logica del parametro per retrocompatibilità |
||
(7 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 36:
['unknown-snak-type'] = 'Tipo di snak sconosciuto',
['unknown-datavalue-type'] = 'Tipo di dato sconosciuto',
['unknown-entity-type'] = 'Tipo di entità sconosciuta',
['unknown-output-format'] = 'Formato di output sconosciuto'
},
somevalue = "''valore sconosciuto''",
Riga 270 ⟶ 271:
local entityId = getEntityIdFromValue(datavalue.value)
if args.showprop then
ret = p._getProperty({ args.showprop, n = 1, from = entityId, formatting = args.formatting }) or ''
elseif args.formatting then
local formatting = args.formatting:lower()
ret = (formatting == 'raw' or formatting == 'id') and entityId or
formatting == 'label' and mw.wikibase.getLabel(entityId) or
formatting == 'title' and (mw.wikibase.getSitelink(entityId) or '') or
error(i18n.errors['unknown-output-format'])
else
ret =
end
elseif datavalue.type == 'string' then
Riga 771 ⟶ 778:
-- Restituisce l'ID dell'item Wikidata collegato alla pagina corrente o a una pagina specificata
-- (nota: se il parametro followRedirects è valorizzato con "no", segue i redirect fermandosi al primo redirect collegato a un elemento)
function p._getId(args)
local ret
local followRedirects = not args.followRedirects or args.followRedirects ~= "no"
if args[1] then
local title = mw.title.new(args[1])
Riga 782 ⟶ 790:
break
else
title = followRedirects and title.redirectTarget or nil
end
end
Riga 874 ⟶ 882:
-- Funzione per il template {{WikidataClasse}}
function p.propertyHasEntity(frame)
local args = getArgs(frame
local propertyId = args[1]
return select(2, xpcall(function()
return p._propertyHasEntity(propertyId, args) and 1 or ''
|