Module:Notice:修订间差异
来自Vocawiki
更多操作
删除的内容 添加的内容
小 如果以匿名参数形式使用,按照text模式输出 |
小无编辑摘要 |
||
| (未显示同一用户的4个中间版本) | |||
| 第5行: | 第5行: | ||
local type = args.type or "info" |
local type = args.type or "info" |
||
-- |
-- 自定义图标(icon) |
||
local icon = args.icon |
|||
local iconClass = "" |
|||
if icon and icon ~= "" then |
|||
iconClass = " notice-icon-" .. icon |
|||
| ⚫ | |||
-- 无标题模式(text) |
|||
local textContent = args.text or args[1] |
local textContent = args.text or args[1] |
||
if textContent and textContent ~= "" then |
if textContent and textContent ~= "" then |
||
return string.format([[ |
return string.format([[ |
||
| ⚫ | |||
<div class="notice notice-%s"> |
|||
| ⚫ | |||
| ⚫ | |||
<div class="notice-text text-base"> |
|||
| ⚫ | |||
</div> |
|||
</div> |
|||
| ⚫ | |||
end |
end |
||
-- 列表 |
-- 列表(list) |
||
local listItems = {} |
local listItems = {} |
||
for i = 1, 50 do |
for i = 1, 50 do |
||
| 第29行: | 第31行: | ||
local listHtml = "" |
local listHtml = "" |
||
if #listItems > 0 then |
if #listItems > 0 then |
||
listHtml = "<ul class=\"notice-list text-sm\">" .. table.concat(listItems, " |
listHtml = "<ul class=\"notice-list text-sm\">" .. table.concat(listItems, "") .. "</ul>" |
||
elseif args.list and args.list ~= "" then |
elseif args.list and args.list ~= "" then |
||
listHtml = "<ul class=\"notice-list text-sm\">" .. args.list .. "</ul>" |
listHtml = "<ul class=\"notice-list text-sm\">" .. args.list .. "</ul>" |
||
end |
|||
-- 列表标题(lt) |
|||
local ltHtml = "" |
|||
if args.lt and args.lt ~= "" then |
|||
| ⚫ | |||
end |
|||
-- 详细说明(detail) |
|||
local detailHtml = "" |
|||
if args.detail and args.detail ~= "" then |
|||
| ⚫ | |||
end |
end |
||
return string.format([[ |
return string.format([[ |
||
| ⚫ | |||
<div class="notice notice-%s"> |
|||
| ⚫ | |||
| ⚫ | |||
<div class="notice-text text-base"> |
|||
<div class="notice-title text-base">%s</div> |
|||
| ⚫ | |||
| ⚫ | |||
</div> |
|||
</div> |
|||
| ⚫ | |||
end |
end |
||
2025年12月28日 (日) 01:53的最新版本
local p = {}
function p.main(frame)
local args = frame:getParent().args
local type = args.type or "info"
-- 自定义图标(icon)
local icon = args.icon
local iconClass = ""
if icon and icon ~= "" then
iconClass = " notice-icon-" .. icon
end
-- 无标题模式(text)
local textContent = args.text or args[1]
if textContent and textContent ~= "" then
return string.format([[
<div class="notice notice-%s"><div class="notice-icon%s" style="-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;-webkit-mask-size:contain;"></div><div class="notice-text text-base"><div class="notice-text-only text-base">%s</div></div></div>
]], type, iconClass, textContent)
end
-- 列表(list)
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, "") .. "</ul>"
elseif args.list and args.list ~= "" then
listHtml = "<ul class=\"notice-list text-sm\">" .. args.list .. "</ul>"
end
-- 列表标题(lt)
local ltHtml = ""
if args.lt and args.lt ~= "" then
ltHtml = '<div class="notice-list-title text-sm">' .. args.lt .. '</div>'
end
-- 详细说明(detail)
local detailHtml = ""
if args.detail and args.detail ~= "" then
detailHtml = '<div class="notice-detail text-sm">' .. args.detail .. '</div>'
end
return string.format([[
<div class="notice notice-%s"><div class="notice-icon%s" style="-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;-webkit-mask-size:contain;"></div><div class="notice-text text-base"><div class="notice-title text-base">%s</div>%s%s%s</div></div>
]], type, iconClass, args.title or "", ltHtml, listHtml, detailHtml)
end
return p