Module:Lua banner:修订间差异

删除的内容 添加的内容
新增 main3 函数(改用 Module:List + argToLink),保留 main/main2 向后兼容
修复 main3:手动构建列表,取消对 Module:List.renderList 的依赖
第5行:
 
local p = {}
 
local function argToLink(t)
-- 将单个参数转化为通往模块的链接。例如将abc转化为模块:Abc|Abc,如果手动添加了模块名字空间也无妨。
local title = mw.title.new(t, 828)▼
return string.format('[[%s|%s]]',tostring(title),tostring(t))▼
end
 
function p.main3(frame)
第16行 ⟶ 第10行:
local currentTitle = mw.title.getCurrentTitle()
local items = {}
for k, v in mTableTools.sparseIpairs(args) do
▲ local title = mw.title.new(tv, 828)
table.insert(items, {content = v})
▲ return table.insert(items, string.format('* [[%s|%s]]', tostring(title),tostring(t v))
end
if #items == 0 then
local subpageBlacklist = {
doc = true,
第26行 ⟶ 第21行:
testcases = true
}
table.insert(items,local {contentfallback = subpageBlacklist[currentTitle.subpageText] and currentTitle.baseText or currentTitle.text})
local title = mw.title.new(fallback, 828)
table.insert(items, string.format('* [[%s|%s]]', tostring(title), fallback))
end
}return table.concat(items, '\n') .. p.renderTrackingCategories(args, args, currentTitle)▼
return mList.renderList {
items = items,
modify = argToLink
▲ } .. p.renderTrackingCategories(args, args, currentTitle)
end