模块:Seplist:修订间差异
跳转到导航
跳转到搜索
删除的内容 添加的内容
Created page with "--Module to implement an unordered list with a generalised separator. Use TemplateStyles with an associated template to style the list. It will recognise "hr" as the horizontal rule. -- p = {} p.makelist = function(frame) local args = frame.args if not args[1] then args = frame:getParent().args if not args[1] then return end end local sep = (args.sep or "") if sep == "hr" then sep = "<hr>" end local out = {} for k, v in ipairs(args) do v = mw.text.tri..." |
小无编辑摘要 |
||
(未显示同一用户的3个中间版本) | |||
第13行: | 第13行: | ||
if not args[1] then return end |
if not args[1] then return end |
||
end |
end |
||
local sep = (args.sep or "") |
local sep = (args.sep or "hr") |
||
if sep == "hr" then sep = "<hr>" end |
if sep == "hr" then sep = "<hr>" end |
||
local out = {} |
local out = {} |
||
for k, v in ipairs(args) do |
for k, v in ipairs(args) do |
||
v = mw.text.trim(v) |
v = mw.text.trim(v) |
||
if v ~= "" then |
|||
table.insert(out, "<li>" .. v .. "</li>") |
table.insert(out, "<li>" .. v .. "</li>") |
||
end |
|||
end |
end |
||
if #out > 0 then |
if #out > 0 then |
2024年7月2日 (二) 07:17的最新版本
此模块的文档可以在模块:Seplist/doc创建
--[[
Module to implement an unordered list with a generalised separator.
Use TemplateStyles with an associated template to style the list.
It will recognise "hr" as the horizontal rule.
--]]
p = {}
p.makelist = function(frame)
local args = frame.args
if not args[1] then
args = frame:getParent().args
if not args[1] then return end
end
local sep = (args.sep or "hr")
if sep == "hr" then sep = "<hr>" end
local out = {}
for k, v in ipairs(args) do
v = mw.text.trim(v)
if v ~= "" then
table.insert(out, "<li>" .. v .. "</li>")
end
end
if #out > 0 then
return '<ul class="seplist">' .. table.concat(out, sep) .. '</ul>'
end
end
return p