打开/关闭搜索
搜索
打开/关闭菜单
3
12
3
300
卡特霍普
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
登录
查看“︁模块:SectionLinkJoin”︁的源代码
来自卡特霍普
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:SectionLinkJoin
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} function p.main(frame) local parent = frame:getParent() local args = parent and parent.args or {} return p._joinSectionLinks(args) end function p._joinSectionLinks(args) local items = {} local maxIndex = 0 for key, value in pairs(args) do if tonumber(key) and value ~= '' then local index = tonumber(key) if index > maxIndex then maxIndex = index end end end for i = 1, maxIndex do if args[i] and args[i] ~= '' then local displayText = args[i] displayText = displayText:gsub("#", " § ") local linkTarget = args['link'..i] or args[i] local link = '[[' .. linkTarget .. '|' .. displayText .. ']]' table.insert(items, link) end end return p._joinList(items) end function p._joinList(list) local count = #list if count == 0 then return "" elseif count == 1 then return list[1] elseif count == 2 then return list[1] .. "和" .. list[2] else local firstPart = table.concat(list, "、", 1, count - 1) return firstPart .. "和" .. list[count] end end return p
该页面使用的模板:
模块:SectionLinkJoin/doc
(
查看源代码
)
返回
模块:SectionLinkJoin
。