模块:Achievements/core
此模块的文档可以在模块:Achievements/core/doc创建
-- Module:Sandbox/Leranjun/achievements/core
-- Made with ♥ by User:Leranjun
local p = {}
local getArgs = require("Module:Arguments").getArgs
function p.main(frame)
local r = ""
local args = getArgs(frame)
if (args.templatestyles == "true") then
r = r .. frame:extensionTag("templatestyles", "", {src = "Template:成就/styles.css"})
end
r = r .. p.generate(args)
return r
end
function p.generate(args)
local r = ""
local row = mw.html.create("div"):addClass("lr-achieve-row")
local imgWrapper = mw.html.create("div"):addClass("lr-achieve-img-wrapper")
local img =
mw.html.create("img"):attr(
"src",
(args.img or "https://gitee.com/mirrors/font-awesome/raw/master/svgs/solid/shoe-prints.svg")
)
imgWrapper:node(tostring(img))
row:node(tostring(imgWrapper))
local txtWrapper = mw.html.create("div"):addClass("lr-achieve-txt-wrapper")
local txt = mw.html.create("div"):addClass("lr-achieve-txt")
local title = mw.html.create("div"):addClass("lr-achieve-title")
title:wikitext(args.title or "千里之行,始于足下")
txt:node(tostring(title))
local sub = mw.html.create("div"):addClass("lr-achieve-sub")
sub:wikitext(args.sub or "编辑数达到1")
txt:node(tostring(sub))
local desc = mw.html.create("div"):addClass("lr-achieve-desc")
desc:wikitext(args.desc or "小心别摔着。")
txt:node(tostring(desc))
txtWrapper:node(tostring(txt))
if (args.time) then
local time = mw.html.create("div"):addClass("lr-achieve-time")
time:wikitext(args.time .. " 解锁")
txtWrapper:node(tostring(time))
end
row:node(tostring(txtWrapper))
r = r .. tostring(row)
return r
end
return p