Module:Infobox/Infobox universelle

Depi Wikipedya, ansiklopedi lib

La documentation pour ce module peut être créée à Module:Infobox/Infobox universelle/doc

local p = {}
local isInstance = require( 'Module:Wikidata' ).isInstance

function p.templateName(frame)
	local item = frame.args[1]
	
	local template = "Infobox Monument" -- plus ou moins passe partout
	
	if isInstance("Q5", item, 0) then
		template = "Infobox Biographie2" 
	elseif isInstance("Q56061", item, 3) then
		template = "Infobox Localité"
	elseif isInstance("Q47461344", item, 2) then
		template = "Infobox Ouvrage"
	elseif isInstance("Q43229", item, 2) then
		template = "Infobox Organisation2"
	end
	return template
end

function p.main(frame)
	local item = frame.args[1]

	local template = "Monument" -- plus ou moins passe partout

	if isInstance("Q5", item, 0) then
		template = "Biographie" 
	elseif isInstance("Q56061", item, 3) then
		template = "Localité"
	elseif isInstance("Q47461344", item, 2) then
		template = "Ouvrage"
	elseif isInstance("Q43229", item, 2) then
		template = "Organisation"
	end
	return template
end
return p