Modulo:DTBase: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
mNessun oggetto della modifica
mNessun oggetto della modifica
Riga 371: Riga 371:
function p.ListReferences(frame)
function p.ListReferences(frame)
local AllReferences = {}
local AllReferences = {}
local item = mw.wikibase.getEntityIdForCurrentPage()
local Item = mw.wikibase.getEntityIdForCurrentPage()
if not item then
if not Item then
item = 'Q1'
Item = 'Q1'
end
end
if Item['claims']['P58'] then
local Statements = mw.wikibase.getAllStatements(Item, 'P58')
local Statements = mw.wikibase.getAllStatements(Item, 'P58')
if not Statements then
return "Nessun riferimento trovato"
else
for _, Statement in pairs(Statements) do
for _, Statement in pairs(Statements) do
local Reference = mw.wikibase.getSitelink(Statement.mainsnak.datavalue.value.id)
local Reference = mw.wikibase.getSitelink(Statement.mainsnak.datavalue.value.id)
Riga 386: Riga 388:
end
end
return table.concat(AllReferences, string.char(10))
return table.concat(AllReferences, string.char(10))
else
return "Nessun riferimento trovato"
end
end
end
end
return p
return p