Modul:Sandkasse
Udseende
return {
entry = function()
local item = mw.wikibase.getEntityIdForCurrentPage()
if not item then return '' end
local results = {}
local statements = mw.wikibase.getBestStatements(item, 'P1')
for _, statement in pairs(statements) do
if statement.mainsnak.snaktype == 'value' then
local value = statement.mainsnak.datavalue.value.id
local sitelink = mw.wikibase.getSitelink(value)
local label = mw.wikibase.getLabel(value)
if sitelink then
if label then
results[#results + 1] = '[[' .. sitelink .. '|' .. label .. ']]'
else
results[#results + 1] = '[[' .. sitelink .. ']]'
end
elseif label then
results[#results + 1] = label
end
end
end
return table.concat(results, ', ')
end
}