跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
MalacoKnowledge
搜索
搜索
登录
个人工具
登录
查看“模块:Ns has subpages”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
←
模块:Ns has subpages
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- This module implements [[Template:Ns has subpages]]. -- While the template is fairly simple, this information is made available to -- Lua directly, so using a module means that we don't have to update the -- template as new namespaces are added. local p = {} function p._main(ns, frame) -- Get the current namespace if we were not passed one. if not ns then ns = mw.title.getCurrentTitle().namespace end -- Look up the namespace table from mw.site.namespaces. This should work -- for a majority of cases. local nsTable = mw.site.namespaces[ns] -- Try using string matching to get the namespace from page names. -- Do a quick and dirty bad title check to try and make sure we do the same -- thing as {{NAMESPACE}} in most cases. if not nsTable and type(ns) == 'string' and not ns:find('[<>|%[%]{}]') then local nsStripped = ns:gsub('^[_%s]*:', '') nsStripped = nsStripped:gsub(':.*$', '') nsTable = mw.site.namespaces[nsStripped] end -- If we still have no match then try the {{NAMESPACE}} parser function, -- which should catch the remainder of cases. Don't use a mw.title object, -- as this would increment the expensive function count for each new page -- tested. if not nsTable then frame = frame or mw.getCurrentFrame() local nsProcessed = frame:callParserFunction('NAMESPACE', ns) nsTable = nsProcessed and mw.site.namespaces[nsProcessed] end return nsTable and nsTable.hasSubpages end function p.main(frame) local ns = frame:getParent().args[1] if ns then ns = ns:match('^%s*(.-)%s*$') -- trim whitespace ns = tonumber(ns) or ns end local hasSubpages = p._main(ns, frame) return hasSubpages and 'yes' or '' end return p
该页面使用的模板:
模块:Ns has subpages/doc
(
查看源代码
)
返回
模块:Ns has subpages
。
开关有限宽度模式