Line 107:
Line 107:
deep_plot2[choice[2]] = deep_plot2[choice[2]] or {}
deep_plot2[choice[2]] = deep_plot2[choice[2]] or {}
table.insert(deep_plot2[choice[2]], 1, choice[1])
table.insert(deep_plot2[choice[2]], 1, choice[1])
+
end
+
if version >= 3 then
+
for _, name in ipairs(index) do
+
for diff in pairs(tbl[name] or {}) do
+
if tbl['choice1' .. name] and not tbl['choice1' .. name][diff] and not tbl['choice2' .. name] or
+
tbl['choice2' .. name] and not tbl['choice2' .. name][diff] and not tbl['choice1' .. name] then
+
local spot = tbl['choice1' .. name] or tbl['choice2' .. name]
+
spot[diff] = tbl[name][diff]
+
U.removekey(tbl[name], diff)
+
end
+
end
+
end
+
local newIndex = {}
+
for _, name in ipairs(index) do
+
if U.size(tbl[name]) == 0 then
+
U.removekey(tbl, name)
+
else
+
table.insert(newIndex, name)
+
end
+
end
+
index = newIndex
end
end
local result = { string.format(template.header, mw.uri.encode(event, 'WIKI')) }
local result = { string.format(template.header, mw.uri.encode(event, 'WIKI')) }
Line 114:
Line 135:
if #choiceIndex > 0 then
if #choiceIndex > 0 then
table.insert(result, template.choice_header)
table.insert(result, template.choice_header)
−
if version == 2 then
+
if version >= 2 then
local done = {}
local done = {}
local first = true
local first = true
Line 205:
Line 226:
-- mw.log(render(nil, 'Summer 2022 Event', 'E-1'))
-- mw.log(render(nil, 'Summer 2022 Event', 'E-1'))
-- mw.log(render(nil, 'Early Spring 2023 Event', 'E-1'))
-- mw.log(render(nil, 'Early Spring 2023 Event', 'E-1'))
−
mw.log(render(nil, 'Summer 2023 Event', 'E-1'))
+
mw.log(render(nil, 'Summer 2023 Event', 'E-3'))
end
end