切換搜尋
搜尋
切換選單
5
23
卡特霍普
導覽
首頁
近期變更
隨機頁面
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
」。