Module:Sandbox/Frietjes: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 2:
-- {{subst:#invoke:CFB schedule/convert|table|...}}
local p = {}
 
local function parseHeader(s)
return '{' .. s .. '}'
end
 
local function parseFooter(s)
return '{' .. s .. '}'
end
 
local function parseEntry(s)
s = '♦MARK♦' .. s
k = 0
while mw.ustring.find(s, '♦MARK♦') and (k < 100) do
k = k + 1
mw.ustring.gsub('(♦MARK♦)%s*%|%s*([^%|{}%[%]=]*=)', '♦%2%1')
mw.ustring.gsub('(♦MARK♦)([^%|{}%[%]=]*)', '%2%1')
mw.ustring.gsub('(♦MARK♦)({[^{}]*})', '%2%1')
mw.ustring.gsub('(♦MARK♦)(%[[^%[%]]*%])', '%2%1')
mw.ustring.gsub('♦MARK♦$', '')
end
return '{' .. s .. '}'
end
 
function p.table(frame)
Line 10 ⟶ 32:
s = mw.ustring.sub(s,1,-3)
if mw.ustring.sub(s,1,5) == 'Entry' then
res = res .. frame:preprocessparseEntry('{{CFB Schedule Entry' .. mw.ustring.sub(s,6) .. '}}')
elseif mw.ustring.sub(s,1,5) == 'Start' then
res = res .. frame:preprocessparseHeader('{{CFB Schedule Start' .. mw.ustring.sub(s,6) .. '}}')
elseif mw.ustring.sub(s,1,3) == 'End' then
res = res .. frame:preprocessparseFooter('{{CFB Schedule End' .. mw.ustring.sub(s,4) .. '}}')
else
res = res .. t