Modul:Wikidata/Formatters/wikibase-entityid
Vzhled
require 'Modul:No globals'
local p = {}
function p.getLinkWhenNonexistingLabel(entityId)
local i18n = mw.loadData('Modul:Wikidata/i18n')
local Category = require 'Modul:Kategorie'
local ImageFormatter = require 'Modul:ImageFormatter'
return ImageFormatter.makeImage('Wikidata-edit.svg', {
description = i18n['missing-label'],
link = 'd:' .. entityId,
size = '27x17px'
}) .. '<code>[[d:' .. entityId .. '|' .. entityId .. ']]</code>'
.. Category.makeCategory(i18n.categories["missing-label"])
end
function p.formatEntityId(entityId, options)
local label = mw.wikibase.label(entityId)
local link = mw.wikibase.sitelink(entityId)
if link then
if label then
return '[[' .. link .. '|' .. label .. ']]'
else
return '[[' .. link .. ']]'
end
elseif label then
return label
else
return p.getLinkWhenNonexistingLabel(entityId)
end
end
return p