<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.statsape.com/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3ANs_has_subpages</id>
	<title>模块:Ns has subpages - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.statsape.com/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3ANs_has_subpages"/>
	<link rel="alternate" type="text/html" href="https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:Ns_has_subpages&amp;action=history"/>
	<updated>2026-05-14T15:36:18Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:Ns_has_subpages&amp;diff=8459&amp;oldid=prev</id>
		<title>Zeroclanzhang：​创建页面，内容为“-- 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&#039;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.names…”</title>
		<link rel="alternate" type="text/html" href="https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:Ns_has_subpages&amp;diff=8459&amp;oldid=prev"/>
		<updated>2024-01-23T07:39:07Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“-- This module implements &lt;a href=&quot;/%E6%A8%A1%E6%9D%BF:Ns_has_subpages&quot; title=&quot;模板:Ns has subpages&quot;&gt;Template:Ns has subpages&lt;/a&gt;. -- While the template is fairly simple, this information is made available to -- Lua directly, so using a module means that we don&amp;#039;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.names…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements [[Template:Ns has subpages]].&lt;br /&gt;
-- While the template is fairly simple, this information is made available to&lt;br /&gt;
-- Lua directly, so using a module means that we don&amp;#039;t have to update the&lt;br /&gt;
-- template as new namespaces are added.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p._main(ns, frame)&lt;br /&gt;
	-- Get the current namespace if we were not passed one.&lt;br /&gt;
	if not ns then&lt;br /&gt;
		ns = mw.title.getCurrentTitle().namespace&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Look up the namespace table from mw.site.namespaces. This should work&lt;br /&gt;
	-- for a majority of cases.&lt;br /&gt;
	local nsTable = mw.site.namespaces[ns]&lt;br /&gt;
&lt;br /&gt;
	-- Try using string matching to get the namespace from page names.&lt;br /&gt;
	-- Do a quick and dirty bad title check to try and make sure we do the same&lt;br /&gt;
	-- thing as {{NAMESPACE}} in most cases.&lt;br /&gt;
	if not nsTable and type(ns) == &amp;#039;string&amp;#039; and not ns:find(&amp;#039;[&amp;lt;&amp;gt;|%[%]{}]&amp;#039;) then&lt;br /&gt;
		local nsStripped = ns:gsub(&amp;#039;^[_%s]*:&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		nsStripped = nsStripped:gsub(&amp;#039;:.*$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		nsTable = mw.site.namespaces[nsStripped]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- If we still have no match then try the {{NAMESPACE}} parser function,&lt;br /&gt;
	-- which should catch the remainder of cases. Don&amp;#039;t use a mw.title object,&lt;br /&gt;
	-- as this would increment the expensive function count for each new page&lt;br /&gt;
	-- tested.&lt;br /&gt;
	if not nsTable then&lt;br /&gt;
		frame = frame or mw.getCurrentFrame()&lt;br /&gt;
		local nsProcessed = frame:callParserFunction(&amp;#039;NAMESPACE&amp;#039;, ns)&lt;br /&gt;
		nsTable = nsProcessed and mw.site.namespaces[nsProcessed]&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return nsTable and nsTable.hasSubpages&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local ns = frame:getParent().args[1]&lt;br /&gt;
	if ns then&lt;br /&gt;
		ns = ns:match(&amp;#039;^%s*(.-)%s*$&amp;#039;) -- trim whitespace&lt;br /&gt;
		ns = tonumber(ns) or ns&lt;br /&gt;
	end&lt;br /&gt;
	local hasSubpages = p._main(ns, frame)&lt;br /&gt;
	return hasSubpages and &amp;#039;yes&amp;#039; or &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zeroclanzhang</name></author>
	</entry>
</feed>