Документацію для цього модуля можна створити у Модуль:SeriesNav/документація

local p = {}

--- Список турнірів у порядку
local series_order = {
    "Get Names 01",
    "Get Names 02",
    "Get Names 03",
    "Get Names 04",
    "Get Names 05",
    "Get Names 06",
    "Get Names 07",
    "Get Names 08",
    "Get Names 09",
    "Women's Closed Cup I",
    "Men's Closed Cup I",
    "Combined Closed Cup I"
}

--- Знаходить індекс турніру
local function find_series_index(series_name)
    for i, name in ipairs(series_order) do
        if name == series_name then
            return i
        end
    end
    return nil
end

--- Повертає посилання на попередній турнір (циклічно)
function p.prevLink(frame)
    local current_series = frame.args[1] or mw.title.getCurrentTitle().text
    local index = find_series_index(current_series)
    
    if not index then
        return '<span style="color:#666;">←</span>'
    end
    
    -- Циклічна навігація: якщо перший, то йдемо до останнього
    local prev_index = index == 1 and #series_order or index - 1
    local prev_series = series_order[prev_index]
    
    return '[[' .. prev_series .. '|←]]'
end

--- Повертає посилання на наступний турнір (циклічно)
function p.nextLink(frame)
    local current_series = frame.args[1] or mw.title.getCurrentTitle().text
    local index = find_series_index(current_series)
    
    if not index then
        return '<span style="color:#666;">→</span>'
    end
    
    -- Циклічна навігація: якщо останній, то йдемо до першого
    local next_index = index == #series_order and 1 or index + 1
    local next_series = series_order[next_index]
    
    return '[[' .. next_series .. '|→]]'
end

return p