首页
随机
登录
设置
关于NeuroWiki
免责声明
NeuroWiki
搜索
查看“Module:Tabs”的源代码
←
Module:Tabs
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local p = {} function p.main(frame) local args = frame:getParent().args local indices = {} -- 收集有效标签索引 for k, _ in pairs(args) do local num = k:match('^bt(%d+)$') or k:match('^tab(%d+)$') if num then indices[tonumber(num)] = true end end -- 处理标签排序 local sorted = {} for k in pairs(indices) do table.insert(sorted, k) end table.sort(sorted) -- 确定默认标签位置(基于参数顺序) local default_pos = math.min(tonumber(args.DefaultTab) or 1, #sorted) -- 构建标签内容 local tabberContent = {} for pos, idx in ipairs(sorted) do local title = args['bt'..idx] or '' local content = args['tab'..idx] or '' table.insert(tabberContent, string.format('|-| %s=%s', title, content)) end return mw.getCurrentFrame():preprocess( '<tabber>\n'..table.concat(tabberContent, '\n')..'\n</tabber>' ) end -- 添加数学函数兼容 math.min = math.min or function(a, b) return a < b and a or b end return p
该页面使用的模板:
Module:Tabs/doc
(
查看源代码
)
返回
Module:Tabs
。