Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

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

local p = {}

local names = {
	F = 'Fire',
	A = 'Air',
	W = 'Water',
	E = 'Earth',
	S = 'Astral',
	D = 'Death',
	N = 'Nature',
	G = 'Glamour',
	B = 'Blood',
	H = 'Holy',
	R = 'Research',
	U = 'Unholy'
}

function p.requirement(frame)
	local raw = frame.args[1] or ''
	local class = frame.args.class or 'domwiki-path'
	local size = frame.args.size or '18x18px'
	local output = {}

	raw = mw.text.trim(raw:gsub(',', ' '))
	for token in raw:gmatch('%S+') do
		local path, level = token:match('^([FAWESDNGBHRU])(%-?%d+)$')
		if path then
			local label = names[path] or path
			local file = string.format('[[File:Path_%s.png|%s|link=|alt=%s]]', path, size, label)
			local span = mw.html.create('span')
				:addClass(class)
				:wikitext(file .. level)
			table.insert(output, tostring(span))
		else
			table.insert(output, token)
		end
	end

	return table.concat(output, ' ')
end

return p