Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 18:29, 15 May 2026 by Nadanke (talk | contribs) (Render path requirements through Lua module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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