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

Module:学园都市资料

猛汉♂百科,万男皆可猛的百科全书!转载请标注来源页面的网页链接,并声明引自猛汉百科。内容不可商用。
跳转到导航 跳转到搜索
模块文档  [创建] [刷新]
local p = {}

function p.main(frame)
    local args = frame:getParent().args  -- 获取模板参数
    local id = 1
    local rows = {}

    -- 添加标题行
    table.insert(rows, '{| align=center width=450px style="border:0px; text-align:center; line-height:1.3em;" class="infotemplate"')
    table.insert(rows, '|-')
    table.insert(rows, '| style="background:#FF0000; color:#FFFFFF; font-size:85%; padding:2px; border:2px; border-style:solid; border-radius:10px;width:450px;" | \'\'\'学园都市-书库:资料\'\'\'')
    table.insert(rows, '|-')
    table.insert(rows, '| style="background:#FF0000; color:#FFFFFF; font-size:85%; padding:2px; border:2px; border-style:solid; border-radius:10px;width:450px;" | \'\'\'机密\'\'\'')
    table.insert(rows, '|}')

    -- 遍历所有编号参数(1, 2, 3...)
    while args[id] ~= nil do
        local val = args[id]
        if val ~= '' then  -- 忽略空值
            table.insert(rows, val)
            table.insert(rows, '{| align=center width=450px style="border:0px; text-align:center; line-height:1.3em;" class="infotemplate"')
            table.insert(rows, '|-')
            table.insert(rows, '| style="background:#000000; color:#000000; font-size:85%; padding:2px; border:2px; border-style:solid; border-radius:10px;width:450px;" | ')
            table.insert(rows, '|}')
        end
        id = id + 1
    end

    -- 返回结果(作为 wikitext 渲染)
    return table.concat(rows, '\n')
end

return p