66 447
contributi
(Link constructor fixed in case of "Category" link) |
Nessun oggetto della modifica |
||
Riga 476: | Riga 476: | ||
return queryResult | return queryResult | ||
end | end | ||
--- Writes a gneric UL list from property, adding SMW link if specified | |||
-- | |||
-- @PName Info from MW session | |||
-- @SMWPrefix | |||
-- @return A bullet list of backlinks | |||
function PropertyList(PName, SMWPrefix) | |||
--{{#invoke:DTBase|PropertyList|P59|Scritto da}} | |||
local AllReferences = {} | |||
local Item = mw.wikibase.getEntityIdForCurrentPage() | |||
if not Item then | |||
Item = 'Q1' | |||
end | |||
local Statements = mw.wikibase.getAllStatements(Item, PName) | |||
if not Statements then | |||
return "Nessun riferimento trovato" | |||
elseif table.getn(Statements) == 1 then | |||
return Statements[1].mainsnak.datavalue.value.id | |||
else | |||
for _, Statement in pairs(Statements) do | |||
--local ReferenceItem = Statement.mainsnak.datavalue.value.id | |||
AllReferences[#AllReferences + 1] = "<li>" .. Statement.mainsnak.datavalue.value.id .. "</li>" | |||
end | |||
return "<ul>" .. table.concat(AllReferences, string.char(10)) .. "</ul>" | |||
end | |||
end | |||
return p | return p |