2023年政策修订增补工作正在进行中,欢迎参与!
  • Moegirl.ICU:萌娘百科流亡社群 581077156(QQ),欢迎对萌娘百科运营感到失望的编辑者加入
  • Moegirl.ICU:账号认领正在试运行,有意者请参照账号认领流程

Module:Sandbox/Leranjun/achievements/single

萌娘百科,万物皆可萌的百科全书!转载请标注来源页面的网页链接,并声明引自萌娘百科。内容不可商用。
跳转到导航 跳转到搜索
Template-info.svg 模块文档  [创建] [刷新]
-- Module:Sandbox/Leranjun/achievements/single
-- Made with ♥ by User:Leranjun

local p = {}

local getArgs = require("Module:Arguments").getArgs
local generate = require("Module:Sandbox/Leranjun/achievements/core").generate

local LIST = mw.loadData("Module:Sandbox/Leranjun/achievements/data")

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

    if (args.templatestyles == "true") then
        r = r .. frame:extensionTag("templatestyles", "", {src = "User:Leranjun/achievements/styles.css"})
    end

    r = r .. p.generate(args[1], args.time, frame)

    return r
end

function p.generate(key, time, frame)
    frame = frame or mw.getCurrentFrame()
    local data = LIST[key]
    if (data) then
        local args = {
            ["img"] = frame:callParserFunction("filepath", data[1]),
            ["title"] = data[2],
            ["sub"] = data[3],
            ["desc"] = data[4],
            ["time"] = time
        }
        return generate(args)
    else
        return ""
    end
end

return p