Jump to content

Module:Taxonbar/blacklist

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tom.Reding (talk | contribs) at 12:54, 14 November 2023 (Create Module:Taxonbar/blacklist to compliment Module:Taxonbar/whitelist). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

--Returns a blacklist of unacceptable wikidata instance-of's,
--either as a table for use inside a module such as [[Module:Taxonbar]],
--or as an ordered list for use in documentation.
function p.blacklist( frame )
	local documentation = frame.args[1]
	local unacceptableInstanceOf_All = { --table order == display order
		'Q913170',		--trivial name
		'Q55983715',	--group of organisms known by one particular common name
		'Q937228',		--property
		'Q14712',		--drupe
		'Q163233',		--compound drupe
		'Q747463',		--compound fruit
	}
	
	if (documentation == nil) or --module only
	   (documentation and documentation == '') then
		local out = {}
		for k, v in pairs( unacceptableInstanceOf_All ) do
			out[v] = k --output Q# as keys for table lookups
		end
		return out
		
	else --documentation only
		local out = ''
		for _, q in pairs( unacceptableInstanceOf_All ) do
			local Q = frame:expandTemplate{ title = 'Q', args = { q } }
			out = out..'# '..Q..'\n'
		end
		return out
	end
	
end

return p