Modulo:Senato.it: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m +XIX legislatura
m rimuovo errore inatteso quando sono assenti le legislature su Wikidata (cfr. talk)
Riga 27:
local function paramError(param_name, no_wikidata)
local error_msg = "il parametro <kbd>" .. param_name .. "</kbd> non è compilato"
 
if no_wikidata == false then
error_msg = error_msg .. " e non è ricavabile da Wikidata"
end
 
return formatError(error_msg)
end
Line 59 ⟶ 57:
-- allora ricava la/e legislatura/e (P2937)
local leg = mWikidata._formatQualifiers(claim, PROP_LEGISLATURA)
if leg == nil then
for l in string.gmatch(leg, "(%w+)") do
return nil
table.insert(legs, formatLegislatura(l))
breakelse
for l in string.gmatch(leg, "(%w+)") do
table.insert(legs, formatLegislatura(l))
break
end
end
end
Line 74 ⟶ 76:
function p._main(args)
local item = args.from
 
-- argomenti in input
local id = args[1] or args['id']
Line 80 ⟶ 82:
local name = mPipetrick(args[3] or args['nome'])
local access_date = args['accesso']
 
-- costanti
local site = 'Senato.it'
local publisher = 'Parlamento italiano'
 
local id_from_WD = not id and getIdFromWikidata(item) or nil
local legs = leg and { formatLegislatura(leg) } or getAllLegsFromWikidata(item)
 
-- gestione messaggi e categorie di errore
local err = select(2, pcall(function ()
Line 98 ⟶ 100:
end
end))
 
if err then
return args['mostra errori'] ~= 'no' and err or nil
end
 
-- icona e categoria Wikidata
local wd_icon = mEditAtWikidata({ pid = PROP_ID_SENATORE, qid = item, id }) or ''
local wd_tracking_cat = mWikidataCheck({ PROP_ID_SENATORE, id }) or ''
 
-- generazione dei link
local url_pattern = "https://www.senato.it/loc/link.asp?tipodoc=sattsen&id=%s&leg=%s"
local altri_link = {}
local first_url, first_title
 
-- link disposti sempre in ordine crescente di legislatura
table.sort(legs, function(n, m) return tonumber(n) < tonumber(m) end)
 
for i = 1, #legs do
local leg = legs[i]
Line 133 ⟶ 135:
end
end
 
return mCitazione.cita_da_modulo('args', {
url = first_url,