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

Module:AnimateText

From Mine in Abyss
Revision as of 13:26, 11 October 2024 by Scyu (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}
function p.animate( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	end
	
	local text = {}
	for row in mw.text.gsplit( args[1], '%s*,,%s*' ) do
		if row == '' then
			table.insert( text, '<span><br></span>' )
		else
			table.insert( text, '<span>' .. row .. '</span>' )
		end
	end
	text[1] = text[1]:gsub( '^<span>', '<span class="animated-active">' )
	
	return '<span class="animated">' .. table.concat( text ) .. '</span>'
end
return p