模块:Multiple releases

求闻百科,共笔求闻
文档图示 模块文档[创建] [跳转到代码]

本模块还没有文档页面。

您可以创建文档以让用户更好地理解本模块的用途。
编者可以在本模块的沙盒创建 | 镜像和测试样例创建页面进行实验。
请将模块自身所属的分类添加在文档中。本模块的子页面
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