<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pttlink.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ANamespace_has_subpages</id>
	<title>Module:Namespace has subpages - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pttlink.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ANamespace_has_subpages"/>
	<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:Namespace_has_subpages&amp;action=history"/>
	<updated>2026-04-06T19:52:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://wiki.pttlink.org/index.php?title=Module:Namespace_has_subpages&amp;diff=8627&amp;oldid=prev</id>
		<title>Kg7qin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:Namespace_has_subpages&amp;diff=8627&amp;oldid=prev"/>
		<updated>2022-01-21T19:05:42Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:05, 21 January 2022&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key mediawiki:diff::1.12:old-8626:rev-8627 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kg7qin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pttlink.org/index.php?title=Module:Namespace_has_subpages&amp;diff=8626&amp;oldid=prev</id>
		<title>Mediawiki&gt;ExE Boss: /* top */ {{ns has subpages}} → {{namespace has subpages}} (per revision 58002725)</title>
		<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:Namespace_has_subpages&amp;diff=8626&amp;oldid=prev"/>
		<updated>2021-09-16T05:13:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;top: &lt;/span&gt; {{ns has subpages}} → {{&lt;a href=&quot;/wiki/Template:Namespace_has_subpages&quot; title=&quot;Template:Namespace has subpages&quot;&gt;namespace has subpages&lt;/a&gt;}} (per &lt;a href=&quot;/index.php?title=C:Special:Diff/58002725&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;C:Special:Diff/58002725 (page does not exist)&quot;&gt;revision 58002725&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements [[Template:Namespace 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'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) == 'string' and not ns:find('[&amp;lt;&amp;gt;|%[%]{}]') then&lt;br /&gt;
		local nsStripped = ns:gsub('^[_%s]*:', '')&lt;br /&gt;
		nsStripped = nsStripped:gsub(':.*$', '')&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'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('NAMESPACE', 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('^%s*(.-)%s*$') -- 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 'yes' or ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Mediawiki&gt;ExE Boss</name></author>
	</entry>
</feed>