Modulo:Cita Wikidata: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m Horcrux ha spostato la pagina Modulo:Sandbox/Horcrux/Cita Wikidata a Modulo:Cita Wikidata senza lasciare redirect
fix vari
Riga 3:
local p = {}
local propertyId
local errorMsg = '<span style="font-size:100%" class="error citation-comment">Errore: parametro <code style="color:red;">$1</code> mancante.</span>'
 
local getArgs = require('Modulo:Arguments').getArgs
Riga 14 ⟶ 15:
end
 
local function getQualifieris_pattern(qualifierId, conjunctionstr )
return is_set(str) and str:find('$1')
return mWikidata._getQualifier( { propertyId, qualifierId, conjunction=conjunction } )
end
 
local function getPropertygetQualifier(urlPatternqualifierId, conjunction)
return mWikidata._getProperty_getQualifier( { propertyId, patternqualifierId, conjunction=urlPatternconjunction } )
end
 
Riga 26 ⟶ 27:
local autoriStringa = getQualifier('P2093')
if is_set(autoriStringa) then
local autoriConLink = getQualifier('P50', "', "')
if is_set(autoriConLink) then
return autoriConLink .. ', ' .. autoriStringa
Riga 50 ⟶ 51:
local args = getArgs(frame)
--TODO:Ritorna ritornareun errore se in args mancano propertyId,i campi medium o urlPatternprop
if not is_set(medium) then return errorMsg:gsub('$1', 'medium') end
if not is_set(prop) then return errorMsg:gsub('$1', 'prop') end
propertyId = args.prop
local medium = args.medium
local identifierFromWD = mWikidata._getProperty( { propertyId } )
local identifier = args.id
local urlTypeidentifier = args.tipourlid or 'titolo'identifierFromWD
local urlPattern = args.patternurl
local urlType
if not is_setis_pattern(args.url) then
urlType = 'titolo'
args.url = args.url:gsub('$1', identifier)
if elseif not is_setis_pattern(args.urlcapitolo) then
urlType = 'capitolo'
args.urlcapitolo = args.urlcapitolo:gsub('$1', identifier)
elseif is_pattern(args.url_capitolo) then
urlType = 'capitolo'
args.url_capitolo = args.url_capitolo:gsub('$1', identifier)
end
-- 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()identifierFromWD then
if not is_set(args.autore) then
args.autore = getAutori()
Riga 68 ⟶ 82:
if not is_set(args.titolo) then
args.titolo = getTitolo()
end
if not is_set(args.url) then
args.url = getProperty(urlPattern)
end
elseif urlType == 'capitolo' then
if not is_set(args.capitolo) then
args.capitolo = getTitolo()
end
if not is_set(args.urlcapitolo) then
args.urlcapitolo = getProperty(urlPattern)
end
end
Riga 87 ⟶ 95:
if not is_set(args.vol) and not is_set(args.volume) then
args.volume = getQualifier('P478')
end
else
if urlType == 'titolo' and not is_set(args.titolo) then
args.titolo = pipetrick()
elseif urlType == 'capitolo' and not is_set(args.capitolo) then
args.capitolo = pipetrick()
end
end
args.cid = args.cid:gsub('$1', identifier)
args.medium = nil
args.prop = nil
args.id = nil
return mCitazione.cita_da_modulo(args.medium, args)
end