有兽档案馆
搜索
切换搜索
切换菜单
切换个人菜单
查看“Module:Sidebar or footer”的源代码
来自有兽档案馆
阅读
查看源代码
查看历史
模块
讨论
更多操作
←
Module:Sidebar or footer
因为以下原因,您没有权限编辑该页面:
您所请求的操作,仅限具有
注册用户
、
自动确认用户
、
管理员
、
界面管理员
、
优质编辑者
、
确认用户
、
巡查员
、
档案理事员
等
权限
的
用户
执行。
若您尚未登录有兽档案馆账号,请您
登录
有兽档案馆账号后操作。
您尚未完成电子邮件确认,因此操作受限,请尽快
完成电子邮件确认
。
若您无法完成前述手续,请通过适当渠道请求管理员或档案理事员协助。
您可以查看和复制此页面的源代码。
若您无权编辑本页面,您可以
提出编辑请求
,提请有权限者代为编辑。
require('Module:No globals') local p = {} local Sidebar = require('Module:Sidebar') local Navbox = require('Module:Navbox') function p.main(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) local footer = args['footer'] local i, j, ni, k, v -- process the groups and lists local groups, lists, nums = {}, {}, {} for k,v in pairs(args) do if type(k) == 'string' and k:match('^list[0-9][0-9]*_[0-9][0-9]*$') then i = mw.ustring.gsub(k,'^list([0-9][0-9]*)_([0-9][0-9]*)$', '%1') j = mw.ustring.gsub(k,'^list([0-9][0-9]*)_([0-9][0-9]*)$', '%2') i = tonumber(i) j = tonumber(j) if lists[i] == nil then lists[i] = {} if groups[i] == nil then table.insert(nums, i) end end lists[i][j] = v elseif type(k) == 'string' and k:match('^group[0-9][0-9]*$') then local i = mw.ustring.gsub(k,'^group([0-9][0-9]*)$', '%1') i = tonumber(i) if groups[i] == nil and lists[i] == nil then table.insert(nums, i) end groups[i] = v end end -- sort the group and list numbers table.sort(nums) -- table for args passed to sidebar or navbox local targs = {} for ni = 1, #nums do i = nums[ni] if footer then if lists[i] then if groups[i] then targs['group' .. i] = args['group' .. i] end targs['list' .. i] = '' for k,v in pairs(lists[i]) do targs['list' .. i] = targs['list' .. i] .. '* ' .. args['list' .. i .. '_' .. k] .. '\n' end else lists[i] = '\'\'\'' .. args['group' .. i] .. '\'\'\'' end else if groups[i] then targs['heading' .. i] = args['group' .. i] end if lists[i] then local leven, lodd = '', '' for k,v in pairs(lists[i]) do if math.fmod(tonumber(k), 2) == 0 then leven = leven .. '* ' .. args['list' .. i .. '_' .. k] .. '\n' else lodd = lodd .. '* ' .. args['list' .. i .. '_' .. k] .. '\n' end end if leven ~= '' and lodd ~= '' then local cb = frame:expandTemplate{ title = 'col-begin' } local c2 = frame:expandTemplate{ title = 'col-2' } local ce = frame:expandTemplate{ title = 'col-end' } targs['content' .. i] = cb .. '\n' .. c2 .. '\n' .. lodd .. c2 .. '\n' .. leven .. ce else targs['content' .. i] = lodd .. leven end end end end targs['name'] = args['name'] or mw.title.getCurrentTitle().text targs['title'] = args['title'] or '{{{title}}}' if footer then targs['listclass'] = 'hlist' targs['state'] = args['state'] or 'autocollapse' return Navbox._navbox(targs) else targs['style'] = 'width: 30em; text-align: left;' targs['class'] = 'collapsible' targs['wraplinks'] = 'true' targs['titlestyle'] = 'font-size: 100%; background-color:lavender; text-align:center;' return Sidebar.sidebar(frame, targs) end end return p
该页面使用的模板:
Module:Arguments
(
查看源代码
)
Module:Documentation
(
查看源代码
)
Module:Fullurl
(
查看源代码
)
Module:Navbar
(
查看源代码
)
Module:Navbox
(
查看源代码
)
Module:No globals
(
查看源代码
)
Module:Page name
(
查看源代码
)
Module:Sidebar
(
查看源代码
)
Module:Sidebar or footer
(
查看源代码
)
Module:Sidebar or footer/doc
(
查看源代码
)
Module:TableTools
(
查看源代码
)
Module:Yesno
(
查看源代码
)
返回
Module:Sidebar or footer
。