انتقل إلى المحتوى

وحدة:صفحات أرشيف متسلسل

من ويكي الجامعة, مركز التعليم الحر
local p = {}

p.listPages = function(frame)
    local args = frame.args
    local pageName = args[1]
    if not pageName or pageName == "" then
        return ""
    end    
    local startNum = tonumber(args[2]) or 1
    if startNum < 1 then
        startNum = 1
    end    
    -- الحد 250 متعلق بالنظام
    local maxLimit = 250 
    local archivePages = {} 
    for i = 0, maxLimit - 1 do
        local currentNum = startNum + i
        local title = mw.title.new(pageName .. "/أرشيف " .. currentNum, '0')
        if title and title.exists then
            table.insert(archivePages, "[[" .. title.fullText .. "|" .. currentNum .. "]]")
        end
    end
    return table.concat(archivePages, " • ")
end

return p