Modulo:Categoria per anno: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m ret→s; inline require
m aggiornato Modulo:Controllo Wikidata, -everyNS +ns
 
(17 versioni intermedie di un altro utente non mostrate)
Riga 1:
local p = {}
 
local DEFAULT_PROP = 'P571'
function err(msg)
local DEFAULT_CHECK_CAT = 'Data di fondazione o creazione'
local DEFAULT_CHECK_GENRE = 'fs'
 
local function err(msg)
string.format('<span class="error">msg</span>', msg)
end
Riga 8 ⟶ 12:
local s = ''
 
ifargs.cat not= args.catPart[1] thenor args.cat
return err('richiesto parametro catPart')
end
 
if not args.wikidataPropcat then
return err('richiesto parametro catPartcat')
args.wikidataProp = 'P571'
end
 
if not args.wikidataLabelGenereprop then
args.wikidataLabelGenereprop = 'fs'DEFAULT_PROP
end
 
local wikidataValuevalue = require('Modulo:Wikidata')._getProperty( {
args.wikidataPropprop,
args.localValuevalue,
from = args.from
} )
if wikidataValuevalue then
 
local year = mw.ustring.match(value, '%d%d%d%d')
if wikidataValue then
if year and year ~= '' then
local year = require('Modulo:String')._match( {
s = wikidataValue,
pattern = '%d%d%d%d',
nomatch = ''
} )
 
if year and year ~= '' then
s = s .. string.format(
args.raw and '%s' or '[[Categoria:%s]]',
string.format(args.catPartcat, year)
)
end
end
 
if not args.controlloWikidataCatraw then
if DEFAULT_PROP == args.prop and not args.checkCat then
args.checkCat = DEFAULT_CHECK_CAT
args.checkGenre = DEFAULT_CHECK_GENRE
end
local check = require('Modulo:Controllo Wikidata')._main( {
args.wikidataPropprop,
args.localValuevalue,
args.controlloWikidataCatcheckCat,
genere = wikidataLabelGenereargs.checkGenre,
ns = args.ns
} )
if check then