Module:Finditem

From Wikispecies
Jump to navigation Jump to search

Usage[edit]

{{#invoke:Finditem|find}}


local p = {}
local i18n = 
	{
		["noentity"] = "[[Category:Articles without Wikidata item]]",
	
	}

function p.find(frame)
	if mw.title.getCurrentTitle().namespace ~= 0
	then
		return ''
	end
	local entity = mw.wikibase.getEntityObject()
	if frame.args[1] == nil 
		then er = i18n.noentity
		else er = frame.args[1]
	end
	P31track = (entity and entity.claims and entity.claims["P31"]) and '' or '[[Category:Instance of not in Wikidata]]'
	if entity 
	then
		return P31track 
	else
	-- This is the place to insert a category for articles that don't have items in Wikidata.
	-- enwiki doesn't seem to have such a category, so in this case it is empty.
	-- For other wikis, just remove the two comment dashes and insert the correct category name.
		return er
	end
end
return p