5233
редагування
Admin (обговорення | внесок) Немає опису редагування |
Admin (обговорення | внесок) Немає опису редагування |
||
| Рядок 13: | Рядок 13: | ||
"Фінал Року" | "Фінал Року" | ||
} | } | ||
-- Мапінг альтернативних назв | |||
local name_mapping = { | |||
["I сезон"] = "Перший сезон", | |||
["II сезон"] = "Другий сезон", | |||
["III сезон"] = "Третій сезон", | |||
["IV сезон"] = "Четвертий сезон", | |||
["V сезон"] = "П'ятий сезон", | |||
["VI сезон"] = "Шостий сезон", | |||
["VII сезон"] = "Сьомий сезон", | |||
["VIII сезон"] = "Восьмий сезон", | |||
["IX сезон"] = "Дев'ятий сезон" | |||
} | |||
local function normalize_name(name) | |||
return name_mapping[name] or name | |||
end | |||
local function find_tournament_index(tournament_name) | local function find_tournament_index(tournament_name) | ||
local normalized = normalize_name(tournament_name) | |||
for i, name in ipairs(tournament_order) do | for i, name in ipairs(tournament_order) do | ||
if name == | if name == normalized then | ||
return i | return i | ||
end | end | ||
| Рядок 25: | Рядок 43: | ||
function p.prevLink(frame) | function p.prevLink(frame) | ||
local current_tournament = frame.args[1] or mw.title.getCurrentTitle().text | local current_tournament = frame.args[1] or mw.title.getCurrentTitle().text | ||
local index = find_tournament_index(current_tournament) | |||
if not index then | |||
if not | return '<span style="color:#666;">←</span>' | ||
return '<span style="color: | |||
end | end | ||
local prev_index = index == 1 and #tournament_order or index - 1 | local prev_index = index == 1 and #tournament_order or index - 1 | ||
local prev_tournament = tournament_order[prev_index] | local prev_tournament = tournament_order[prev_index] | ||
| Рядок 40: | Рядок 57: | ||
function p.nextLink(frame) | function p.nextLink(frame) | ||
local current_tournament = frame.args[1] or mw.title.getCurrentTitle().text | local current_tournament = frame.args[1] or mw.title.getCurrentTitle().text | ||
local index = find_tournament_index(current_tournament) | |||
if not index then | |||
if not | return '<span style="color:#666;">→</span>' | ||
return '<span style="color: | |||
end | end | ||
local next_index = index == #tournament_order and 1 or index + 1 | local next_index = index == #tournament_order and 1 or index + 1 | ||
local next_tournament = tournament_order[next_index] | local next_tournament = tournament_order[next_index] | ||