Modulo:StagioniTV/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 24:
local id, localID, tipo, titolo, etichetta, sitelink, stagioni
local pageTitle = args[1] or args.titolo
 
-- Rileva l'identificativo della scheda wikidata collegata alla fiction o al programma TV,
-- se nessun titolo è specificato prova a recuperlo dalla voce della stagione/edizione, se questa ha una sua scheda su wikidata
if not args[1] or args.titolo then
if string.find(mw.title.getCurrentTitle().text, '^Episodi d[ei]') then
Riga 34 ⟶ 36:
else id = mw.wikibase.getEntityIdForTitle( pageTitle )
end
 
-- Identifica il tipo di programma (serie televisiva, serie animata o programma TV generico)
-- ed estrae gli altri dati fondamentali da Wikidata (etichetta in italiano, numero stagioni, sitelink)
-- se uno di essi non è presente è generato un messaggio di errore
if wikidata._instanceOf({ 'Q581714', from = id }) then tipo = 'animata'
elseif wikidata._instanceOf({ 'Q5398426', from = id }) then tipo = 'serie TV'
Riga 40 ⟶ 45:
end
if id then
--non_usato-- titolo = wikidata._getLink({ id })
etichetta = wikidata._getLabel({ id, 'it'})
sitelink = mw.wikibase.sitelink( id )
Riga 51 ⟶ 56:
else
 
-- Questa parte del codice genere i collegamenti alle singole edizioni/stagioni e la relativa categoria
local tbl = {}
local lang = mw.language.getContentLanguage()
Riga 97 ⟶ 103:
end
 
-- Infine è generato il navbox con i dati su estratti e formattati
if not id or not etichetta or not stagioni then
template = mw.title.getCurrentTitle().namespace == 0 and errorCategory or nil