Soft launch: Soldier biographies and research notes vary in completeness. Prefer class-roster, NARA, newspapers, and other cited sources for contested facts — treat Research notes as leads, not settled history. Anyone can correct a page; contact us with questions.

Module:SplitCats

From Ritchie Boys Wiki
Revision as of 02:00, 18 August 2026 by Admin (talk | contribs) (Import Lua helper)
Jump to navigation Jump to search

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

local p = {}

function p.categories(frame)
	local raw = frame.args[1] or ''
	local prefix = frame.args[2] or 'Class '
	local out = {}
	for part in mw.text.gsplit(raw, ';', true) do
		part = mw.text.trim(part)
		if part ~= '' then
			table.insert(out, '[[Category:' .. prefix .. part .. ']]')
		end
	end
	return table.concat(out)
end

function p.letterCategory(frame)
	local title = mw.title.getCurrentTitle()
	local first = mw.ustring.upper(mw.ustring.sub(title.text, 1, 1))
	if mw.ustring.match(first, '[A-Z]') then
		return '[[Category:Soldiers ' .. first .. ']]'
	end
	return '[[Category:Soldiers other]]'
end

return p