缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!
该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!
全站通知:
模块:PortableNavbox
刷
历
编
跳到导航
跳到搜索
-- This Module is used for making templates based in the Lua language.
-- See more details about Lua in [[w:Help:Lua]].
-- The Fandom Developer's Wiki hosts Global Lua Modules that can be imported and locally overridden.
-- The next line imports the PortableNavbox module from the [[w:c:dev:Global Lua Modules]].
-- See more details about this module at [[w:c:dev:Global_Lua_Modules/PortableNavbox]]
-- @module PortableNavbox
local p = {}
local yesno = require('Module:Dev/Yesno')
local title = mw.title.getCurrentTitle()
function p.main(frame)
local args = require('Module:Dev/Arguments').getArgs(frame)
local classes = "pi-navbox"
if args.class ~= nil then classes = classes .. " " .. args.class end
local contents = {}
if not args.nowrapper then
table.insert(contents, '<div class="' .. classes .. '">')
table.insert(contents,
'<infobox theme="' .. (args.theme or 'navbox') .. '" >')
end
table.insert(contents, '<group')
if args.collapse ~= nil then
if yesno(args.collapse, true) then -- Collapse true: close
table.insert(contents, ' collapse="closed"')
else -- Collapse false: open
table.insert(contents, ' collapse="open"')
end
end
table.insert(contents, '>')
if args[1] then
table.insert(contents, '<header>')
table.insert(contents, mw.text.trim(args[1]))
table.insert(contents, '</header>')
end
for k, v in ipairs(args) do
local i = tonumber(k)
if i and v and i > 1 then
i = i - 2
if i % 2 == 0 then
table.insert(contents, '<data><label>')
table.insert(contents, mw.text.trim(v))
table.insert(contents, '</label>')
else
local r = mw.ustring.gsub(mw.text.trim(v), table.concat(
{' ', args.separator or '!', ' '}),
' • <wbr>')
table.insert(contents, '<default>')
table.insert(contents, mw.text.trim(r))
table.insert(contents, '</default></data>')
end
end
end
table.insert(contents, '</group>')
if not args.nowrapper then table.insert(contents, '</infobox></div>') end
contents = table.concat(contents)
if title.namespace ~= 829 or title.subpageText ~= 'testcases' then
if not args.raw then
contents = mw.getCurrentFrame():preprocess(contents)
end
end
return contents
end
return p