Jump to content

Module:TaxonList

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Peter coxhead (talk | contribs) at 07:45, 11 November 2017 (Undid revision 809766854 by Peter coxhead (talk)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.main(frame)
	local italic = (frame.args['italic'] or '') == 'yes'
	local linked = (frame.args['linked'] or '') == 'yes'
	local parentArgs = frame:getParent().args
	local result = ''
	local num
	-- iterate over unnamed variables
	local first = true
	for name, value in pairs(parentArgs) do
		if tonumber(name) then
			if first then
				local taxon = value
				if linked then
					taxon = '[[' .. taxon .. ']]'
				end
				if italic then
					taxon = "''" .. taxon .. "''"
				end
				result = result .. taxon
			else
				result = result .. ' <small>' .. value .. '</small><br>'
			end
			first = not first
		end
	end
	return '<li>' .. result .. '</li>'
end

return p