跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
天灾之下:危险连接官网(建设中)
天灾之下:危险连接QQ群
天灾之下:危险连接 Bilibili
冰糖服务器
冰糖服务器QQ群
天灾之下:危险连接资料站
搜索
搜索
中文(中国大陆)
外观
创建账号
登录
个人工具
创建账号
登录
查看“︁模块:Tmpl”︁的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
页面信息
[[雷光]]
外观
移至侧栏
隐藏
←
模块:Tmpl
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- This is a helper module for {{tmpl}} require('strict') -- The trailing `[^0-9]?` ensures that `$10` doesn't potentially change -- from being treated as `${1}0` to being treated as `${10}` -- if the number of supported parameters is ever expanded: local PATTERN = "%$([1-9])[^0-9]?" local this = {} function this.renderTmpl(frame) local args = frame.args local pargs = (frame:getParent() or {}).args local input = pargs[0] or '' local result = {} local prevPos = 1 do local startPos, _, k while true do startPos, _, k = string.find(input, PATTERN, prevPos) if (not startPos) then break end table.insert(result, string.sub(input, prevPos, startPos - 1)) local n = tonumber(k) local r = pargs[n] if (r) then table.insert(result, r) else table.insert(result, '$' .. n) end prevPos = startPos + #k + 1 end end table.insert(result, string.sub(input, prevPos)) return table.concat(result) end return this
该页面嵌入的页面:
模块:Tmpl/doc
(
查看源代码
)
返回
模块:Tmpl
。
搜索
搜索
查看“︁模块:Tmpl”︁的源代码
添加语言
添加话题