Open main menu

Yugipedia β

Module:Slugify

Module documentation[create]
-- <pre>

--
-- implements {{Slugify}}
--

local mArguments --lazily initialize
local p = {}

function p.slugify( frame )
	mArguments = mArguments or require( 'Module:Arguments' )
	local args = mArguments.getArgs( frame, { parentOnly = true } )
	
	local str = args[1] or ''
	
	-- this probably misses some characters
	str = str
		:gsub( '%-', ' ' )
		:gsub( '%p', '' )
		:gsub( '%s+', '-')
	
	return str:lower()
end

return p

-- </pre>