Modulo:Autore: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m fix
nuove funzioni
Riga 21:
-- SPERIMENTALE --
 
-- elemento di Wikidata: supporto anticipato per la Fase 2
local item = nilmw.wikibase.getEntityObject()
if mw.wikibase~=nil and mw.wikibase.getEntity~=nil then
item = mw.wikibase.getEntity()
end
 
function cda(test)
Line 95 ⟶ 92:
end
end
end
end
end
 
local gender = ''
if item and item.claims and item.claims.P21 and #item.claims.P21 == 1 then
local claim = item.claims.P21[1]
if claim.mainsnak.datavalue and claim.mainsnak.datavalue.value and claim.mainsnak.datavalue.value['numeric-id'] then
local n = claim.mainsnak.datavalue.value['numeric-id']
if n == 6581097 then
gender = 'male'
elseif n == 6581072 then
gender = 'female'
end
end
Line 101 ⟶ 111:
-- Restituisce il collegamento corrispondente al codice fornito
function sitelink(dbname)
if item~=nil and item.sitelinks[:getSitelink(dbname]~=nil) then
return item.sitelinks[:getSitelink(dbname].title)
end
end
Line 353 ⟶ 363:
 
-- AUTORI SENZA ELEMENTO SU WIKIDATA
if not item then
if mw.wikibase~=nil and mw.wikibase.getEntity~=nil and item==nil then
addCat('Autori non collegati a Wikidata')
end
Line 380 ⟶ 390:
add(' ('..nascita..' – '..morte..')')
end
 
local oa = lang:gender(gender, 'o', 'a', 'o/a')
 
-- EVENTUALE ALTRO NOME
if args['Eventuale altro nome']~=nil then
add(', noto/anot'..oa..' anche come \'\'\''..args['Eventuale altro nome']..'\'\'\'')
end
-- EVENTUALE PSEUDONIMO
if args['Eventuale pseudonimo']~=nil then
add(', noto/anot'..oa..' anche con lo pseudonimo di \'\'\''..args['Eventuale pseudonimo']..'\'\'\'')
end
 
-- EVENTUALE NOME REALE
-- TODO: sesso (M/F) da Wikidata
if args['Eventuale nome reale']~=nil then
add(', nato/anat'..oa..' \'\'\''..args['Eventuale nome reale']..'\'\'\'')
end