跳转到内容

模組:Multiple releases

维基百科,自由的百科全书

这是Module:Multiple releases当前版本,由Great Brightstar留言 | 贡献编辑于2017年12月17日 (日) 11:04。这个网址是本页该版本的固定链接。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)
local infobox = require ('Module:Infobox').infobox
local getArgs = require ('Module:Arguments').getArgs

local p = {}

function p.main( frame )
    local args = getArgs (frame)

    InfoboxArgs = {}
    InfoboxArgs["subbox"] = "yes"
    InfoboxArgs["bodystyle"] = "text-align:left"

    local a = 1
    local IsEmpty = true
    local KeepCheckingForArgs = true
    while KeepCheckingForArgs == true do
        local thisBranch = "branch" .. a
        local thisVersion = "version" .. a
        local thisDate = "date" .. a
        local CurLabel = "label" .. a
        local CurData = "data" .. a

        if args[thisBranch] and args[thisVersion] then
            InfoboxArgs[CurLabel] = args[thisBranch]
            InfoboxArgs[CurData] = args[thisVersion]
            if args[thisDate] then InfoboxArgs[CurData] = InfoboxArgs[CurData] .. "<small>(" .. args[thisDate] .. ")</small>" end
        else
            KeepCheckingForArgs = false
            if a > 1 then IsEmpty = false end
        end
        a = a + 1
    end

    if IsEmpty == false then
        return infobox(InfoboxArgs)
    else
        return nil
    end
end

return p