local getArgs = require('Modul:Arguments').getArgs

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	local ns = mw.title.getCurrentTitle().namespace
	if ns ~= 118 and ns ~= 2 and ns ~= 4 then
		return '[[Kategorija:Predloga AfC topic, uporabljena v napačnem imenskem prostoru]]'
	end
	
	local data = mw.loadJsonData('Wikipedija:Članki za ustvaritev/AfC topic map.json')
	
	local topic = args[1]
	local match = data[topic]
	
	if match ~= nil then
		return '[[Kategorija:' .. match.category .. ']]'
	else 
		return '[[Kategorija:AfC topic: neveljaven parameter]]'
	end
	
end

return p