Module:Sandbox/Frietjes

This is an old revision of this page, as edited by Frietjes (talk | contribs) at 16:56, 31 January 2018. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- CFB schedule table conversion
-- {{subst:#invoke:CFB schedule/convert|table|...}}
local p = {}

function p.table(frame)
	local res = ''
	for t in mw.text.gsplit(frame.args[1] or '', '{{[_%s]*CFB[_%s]*Schedule[_%s]*') do
		local s = t:match( '^%s*(.-)%s*$' )
		if mw.ustring.sub(s,-2) == '}}' then
			s = mw.ustring.sub(s,1,-3)
			if mw.ustring.sub(s,1,5) == 'Entry' then
				res = res .. frame:expand('{{CFB Schedule Entry' .. mw.ustring.sub(s,6) .. '}}')
			elseif mw.ustring.sub(s,1,5) == 'Start' then
				res = res .. frame:expand('{{CFB Schedule Start' .. mw.ustring.sub(s,6) .. '}}')
			elseif mw.ustring.sub(s,1,3) == 'End' then
				res = res .. frame:expand('{{CFB Schedule End' .. mw.ustring.sub(s,4) .. '}}')
			else
				res = res .. t
			end
		else
			res = res .. t
		end
	end
	return res
end
return p