Modulo:Cita Wikidata: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m typo |
Nessun oggetto della modifica |
||
Riga 1:
require('Modulo:No globals')
local p = {}
local propertyId
local getArgs = require('Modulo:Arguments').getArgs
local mWikidata = require('Modulo:Wikidata')
local mCitazione = require('Modulo:Citazione')
local pipetrick = require('Modulo:Pipetrick')._pipetrick
-- Funzioni di supporto
local function is_set( var )
return not (var == nil or var == '');
Riga 14 ⟶ 18:
end
return mWikidata._getProperty( { propertyId, pattern=urlPattern } )▼
end▼
-- Funzioni per ricavare dati specifici
local function getAutori()
local autoriStringa = getQualifier('P2093')
Riga 34 ⟶ 43:
or getQualifier('P742')
or getQualifier('P554')
or pipetrick()
return titolo
▲end
▲local function getUrl(urlPattern)
▲ return mWikidata._getProperty( { propertyId, pattern=urlPattern } )
end
function p.getCitation(frame)
local args = getArgs(frame)
--TODO: ritornare errore se mancano propertyId, medium o urlPattern
propertyId = args.prop
Riga 53 ⟶ 60:
-- Se un identificatore è specificato, allora si sta forzando l'inserimento manuale;
-- in tal caso, nessun dato va ricavato da Wikidata, altrimenti si rischierebbero incongruenze fra i dati manuali e quelli automatici
if not is_set(identifier) or identifier == getProperty() then
if not is_set(args.autore) then
args.autore = getAutori()
Riga 63 ⟶ 70:
end
if not is_set(args.url) then
args.url =
end
elseif urlType == 'capitolo' then
Riga 70 ⟶ 77:
end
if not is_set(args.urlcapitolo) then
args.urlcapitolo =
end
end
|