Module:Tabs:修订间差异
创建页面,内容为“local p = {} function p.main(frame) local args = frame:getParent().args local tabs = {} local indices = {} -- 收集所有存在的标签索引 for k, _ in pairs(args) do local num = k:match('^bt(%d+)$') or k:match('^tab(%d+)$') if num then num = tonumber(num) indices[num] = true end end -- 转换并排序索引 local sorted = {} for k in pairs(indices) do tab…” |
无编辑摘要 |
||
第37行: | 第37行: | ||
local tab = args['tab'..i] or '' | local tab = args['tab'..i] or '' | ||
-- | -- 构建标题(移除nowiki处理) | ||
local title = bticon .. bt | local title = bticon .. bt | ||
if i == default then | if i == default then | ||
title = title .. '@selected' | title = title .. '@selected' | ||
end | end | ||
table.insert(tabberContent, '|-| '..title..' = '..tab) | table.insert(tabberContent, '|-| '..title..' = '..tab) | ||
end | end | ||
-- 使用preprocess解析标签 | |||
local content = '<tabber>\n'..table.concat(tabberContent, '\n')..'\n</tabber>' | |||
return mw.getCurrentFrame():preprocess(content) | |||
end | end | ||
return p | return p |