Module:CovidVacNum

Documentation for this module may be created at Module:CovidVacNum/doc

local p = {}

function p.main(frame)
	local ch = {'F', 'E'}
	local what = {'Full', 'Emergency'}
	local page = "List of COVID-19 vaccine authorizations"
	local args = require('Module:Arguments').getArgs(frame)
	local n = {0,0}
	if  args[1] == nil  then
		return 'Name of section is required'
	else	
		for k = 1, 2 do
			n[k] = frame:preprocess('{{#section:'..page..'|'..args[1]..'_'..ch[k]..'N}}')
			local num = 0
			if (n[k] ~= nil) and (n[k] ~= '') then
				num = tonumber(n[k])
				if num == nil then
					return 'Invalid number ('..n[k]..')'
				end	
			end	
			n[k] = what[k]..' ('..num..')'
		end	
		return '[['..page..'#'..args[1]..'|'..n[1]..'</br>'..n[2]..']]'
	end  
end	--main	

return p