欢迎来到奇葩栖息地!欢迎加入Discord服务器:XfrfHCzfbW欢迎加入QQ频道:r01m9y3iz6请先至特殊:参数设置验证邮箱后再进行编辑。特殊:参数设置挑选自己想要使用的小工具!不会编辑?请至这里学习Wikitext语法。

模块:AnimateText

来自奇葩栖息地

本模块用于实现{{AnimateText}}

local p = {}
function p.animate( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	end

	delimiter = args.delimiter or args.d or ',,'
	local text = {}
	for row in mw.text.gsplit( args[1], '%s*' .. delimiter .. '%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