Jump to content
Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

La documentation pour ce module peut être créée à Module:Téléchargements/doc

local p = {}

function p.main(frame)
    local args = frame:getParent().args
    local titre = args['titre']
    if not titre or titre == '' then
        titre = 'Versions archivées de ' .. mw.title.getCurrentTitle().text
    end

    local rows = {}
    local i = 1
    while true do
        local edition = args['edition' .. i]
        if not edition or edition == '' then
            break
        end
        local version = args['version' .. i] or ''
        local langue = args['langue' .. i] or ''
        local description = args['description' .. i] or ''
        local format = args['format' .. i] or ''
        local image = args['image' .. i] or ''
        local liens = args['liens' .. i] or ''

        local row = '|-\n'
            .. '|\n' .. "'''" .. edition .. "'''\n"
            .. '|\n' .. version .. '\n'
            .. '|\n' .. langue .. '\n'
            .. '|\n' .. description .. '\n'
            .. '|\n' .. format .. '\n'
            .. '|\n' .. image .. '\n'
            .. '|\n' .. liens .. '\n'
        table.insert(rows, row)
        i = i + 1
    end

    if #rows == 0 then
        return ''
    end

local out = '<div class="ith-dl-wrap">\n'
        .. '{| class="wikitable sortable mw-collapsible ith-dl-table"\n'
        .. '|+ ' .. titre .. '\n'
        .. '! Édition !! Version !! Langue !! Description !! Format !! Image !! Téléchargement\n'
        .. table.concat(rows)
        .. '|}\n'
        .. '</div>'

    return out
end

return p