2 354
contributi
(ampliamento hasQualifierValue) |
m (una versione importata) |
||
(4 versioni intermedie di 3 utenti non mostrate) | |||
Riga 16: | Riga 16: | ||
-- ============================================================================= | -- ============================================================================= | ||
require(' | require('strict') | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local mConvert = require('Module:Conversione') | local mConvert = require('Module:Conversione') | ||
local mLanguages = require('Module: | local mLanguages = require('Module:Lingue') | ||
-- Categoria per le pagine con errori | -- Categoria per le pagine con errori | ||
Riga 36: | Riga 36: | ||
['unknown-snak-type'] = 'Tipo di snak sconosciuto', | ['unknown-snak-type'] = 'Tipo di snak sconosciuto', | ||
['unknown-datavalue-type'] = 'Tipo di dato sconosciuto', | ['unknown-datavalue-type'] = 'Tipo di dato sconosciuto', | ||
['unknown-entity-type'] = 'Tipo di entità sconosciuta' | ['unknown-entity-type'] = 'Tipo di entità sconosciuta', | ||
['unknown-output-format'] = 'Formato di output sconosciuto' | |||
}, | }, | ||
somevalue = "''valore sconosciuto''", | somevalue = "''valore sconosciuto''", | ||
Riga 270: | Riga 271: | ||
local entityId = getEntityIdFromValue(datavalue.value) | local entityId = getEntityIdFromValue(datavalue.value) | ||
if args.showprop then | if args.showprop then | ||
ret = p._getProperty({ args.showprop, n = 1, from = entityId }) or '' | 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 | |||
error(i18n.errors['unknown-output-format']) | |||
else | else | ||
ret = | ret = formatEntityId(entityId) | ||
end | end | ||
elseif datavalue.type == 'string' then | elseif datavalue.type == 'string' then | ||
Riga 869: | Riga 876: | ||
return select(2, xpcall(function() | return select(2, xpcall(function() | ||
return p._N(getArgs(frame, { parentOnly = true })) > 0 and 1 or '' | return p._N(getArgs(frame, { parentOnly = true })) > 0 and 1 or '' | ||
end, errhandler)) | |||
end | |||
-- 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 '' | |||
end, errhandler)) | end, errhandler)) | ||
end | end | ||
return p | return p |
contributi