Modulo:Controllo Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m +parametro debug |
m Bot: rimuovo no globals obsoleto |
||
(5 versioni intermedie di un altro utente non mostrate) | |||
Riga 3:
]]--
require('
local getArgs = require('Modulo:Arguments').getArgs
Riga 29:
end
local function getCategory(wdval, userval
local comparefunc = function(v1, v2) return v1 == v2 end
local cat
Riga 36 ⟶ 35:
-- consente di definire funzioni di confronto per proprietà specifiche
-- (oppure tramite eventuali parametri)
if args.id ~= 'no' then▼
▲ if mWikidata._getDatatype({ args[1] }) == 'file multimediale su Commons' then
▲ comparefunc = compareCommonsMediaFile
▲ comparefunc = compareURL
end
if userval then
if not wdval then
cat = string.format('%s assente su Wikidata',
elseif args.uguale ~= 'no' and comparefunc(wdval, userval) then
cat = string.format('%s uguale
elseif args.diff ~= 'no' then
cat = string.format('%s differente
end
elseif wdval then
cat = string.format('%s
end
Riga 61 ⟶ 58:
-- Per l'utilizzo da altro modulo
function p._main(args)
local wdprop, userval
-- namespace 0
if (mw.title.getCurrentTitle().namespace ~= 0
return nil
end
unit = args.unit,
from = args.debug and args.from
▲ wdval = mWikidata._getProperty({
▲ wdprop,
▲ showunit = args['unità'] ~= 'no',
▲ })
▲ return getCategory(wdval, userval, catprefix, args)
end
--
function p.main(frame)
return p._main(getArgs(frame, { parentOnly = true }))
end
|