Aller au contenu

Module:Wikidata-badges

Une page de Wikipédia, l'encyclopédie libre.

 Documentation[créer] [purger]
local p = {}

function p.badges(frame)
	local site = frame.args[1]
	local id = frame.args[2]
	if not site then
		return printError("site-not-found")
	end
	if not id then
		id = mw.wikibase.getEntityIdForCurrentPage()
		if not id then
			return printError("entity-not-found")
		end
	else
		if not mw.wikibase.entityExists(id) then
			return printError("entity-not-found")
		end
	end
	local badges = mw.wikibase.getBadges(id, site)
	if badges then
		return table.concat(badges, "/")
	end
end

return p