打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
登录后可编辑和发表评论。

Module:Notice

来自Vocawiki

此模块的文档可以在Module:Notice/doc创建

local p = {}

function p.main(frame)
    local args = frame:getParent().args
    local type = args.type or "info"

    -- text模式
    if args.text and args.text ~= "" then
        return string.format([[
<div class="notice notice-%s">
  <div class="notice-icon"></div>
  <div class="notice-text text-base">
    <div class="notice-text-only text-base">%s</div>
  </div>
</div>
]], type, args.text)
    end

    -- 列表
    local listItems = {}
    for i = 1, 50 do
        local key = "l" .. i
        if args[key] and args[key] ~= "" then
            table.insert(listItems, "<li>" .. args[key] .. "</li>")
        end
    end

    local listHtml = ""
    if #listItems > 0 then
        listHtml = "<ul class=\"notice-list text-sm\">" .. table.concat(listItems, "\n") .. "</ul>"
    elseif args.list and args.list ~= "" then
        listHtml = "<ul class=\"notice-list text-sm\">" .. args.list .. "</ul>"
    end

    return string.format([[
<div class="notice notice-%s">
  <div class="notice-icon"></div>
  <div class="notice-text text-base">
    <div class="notice-title text-base">%s</div>
    %s
    <div class="notice-detail text-sm">%s</div>
  </div>
</div>
]], type, args.title or "", listHtml, args.detail or "")
end

return p