七日内新公告:全站维护公告
  • 你好~!欢迎来到萌娘百科镜像站!如需查看或编辑,请联系本站管理员注册账号。
  • 本镜像站和其他萌娘百科的镜像站无关,请注意分别。

Module:Sandbox/Ithea

贴贴♀百科,万娘皆可贴的百科全书!转载请标注来源页面的网页链接,并声明引自贴贴百科。内容不可商用。
跳到导航 跳到搜索
Template-info.svg 模块文档  [查看] [编辑] [历史] [刷新]
local getArgs = require('Module:Arguments').getArgs
local p = {}
 
function p.main(frame)
	local args = getArgs(frame)
	local lang = args["lang"] or "ja"
    local result = {}
    local indices = {}

    for k, _ in pairs(args) do
        local idx = tostring(k):match("^lb%-text(%d+)$")
        if idx then
            table.insert(indices, tonumber(idx))
        end
    end
    table.sort(indices)

    -- 按序输出
    for _, i in ipairs(indices) do
        local lb = args["lb-text" .. i] or ""
        local rb = args["rb-text" .. i] or ""
        local lbcolor = args["lb-color" .. i] or args["lb-color"] or ""
        local rbcolor = args["rb-color" .. i] or args["rb-color"] or ""

        table.insert(result,
            frame:expandTemplate{
                title = "Lyrics/brick",
                args = {
                    ["lb"] = lb,
                    ["rb"] = rb,
                    ["lb-color"] = lbcolor,
                    ["rb-color"] = rbcolor,
                    ["lang"] = lang
                }
            }
        )
    end

    return table.concat(result, "")
end
 
return p