Modulo:Controllo Wikidata: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m 'sì' |
il controllo va fatto al netto della formattazione dell'output |
||
(7 versioni intermedie di 3 utenti 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
Line 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
return cat and string.format('[[
end
-- Per l'utilizzo da altro modulo
function p._main(args)
local wdprop, userval
if
▲ -- namespace 0, proprietà Wikidata e prefisso categoria obbligatori
▲ if (mw.title.getCurrentTitle().namespace ~= 0 and args.everyNS ~= 'sì') or (args.id ~= 'no' and not wdprop) or not catprefix then
return nil
end
unit = args.unit,
showunit = args.showunit,
formatting = args.formatting,
from = args.debug and args.from
▲ wdval = mWikidata._getProperty({
▲ wdprop,
▲ })
▲ return getCategory(wdval, userval, catprefix, args)
end
--
function p.main(frame)
return p._main(getArgs(frame, { parentOnly = true }))
end
|