Module:topics

Revision as of 23:03, 8 March 2024 by TheNightAvl (talk | contribs) (Added auto-capping)

Documentation for this module may be created at Module:topics/documentation

local export = {}
local m_languages = require("Module:languages")

function export.show(frame)
	local args = frame:getParent().args
	local language = m_languages.get_by_code(args[1])
	local cats = ""
	local i = 2
	while args[i] do
		local capped = mw.ustring.upper(mw.ustring.sub(args[i],1,1)) .. mw.ustring.sub(args[i],2) or ""
		cats = cats .. "[[Category:" .. language.code .. ":" .. capped .. "]]"
		i = i + 1
	end
	if cats == "" then
		error("at least 1 topic must be supplied to {{topic}}")
	end
	return cats
end

return export