<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AUnsubst</id>
	<title>Module:Unsubst - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AUnsubst"/>
	<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:Unsubst&amp;action=history"/>
	<updated>2026-04-04T18:23:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://www.limswiki.org/index.php?title=Module:Unsubst&amp;diff=27149&amp;oldid=prev</id>
		<title>Shawndouglas: Protected &quot;Module:Unsubst&quot; ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:Unsubst&amp;diff=27149&amp;oldid=prev"/>
		<updated>2016-08-18T20:26:55Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/index.php/Module:Unsubst&quot; title=&quot;Module:Unsubst&quot;&gt;Module:Unsubst&lt;/a&gt;&amp;quot; ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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 20:26, 18 August 2016&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key limswiki:diff::1.12:old-27139:rev-27149 --&gt;
&lt;/table&gt;</summary>
		<author><name>Shawndouglas</name></author>
	</entry>
	<entry>
		<id>https://www.limswiki.org/index.php?title=Module:Unsubst&amp;diff=27139&amp;oldid=prev</id>
		<title>Shawndouglas: Created as needed.</title>
		<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:Unsubst&amp;diff=27139&amp;oldid=prev"/>
		<updated>2016-08-18T20:10:05Z</updated>

		<summary type="html">&lt;p&gt;Created as needed.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local specialParams = {&lt;br /&gt;
	['$N'] = 'template name', -- Deprecated, but keeping until it is removed from transcluding templates&lt;br /&gt;
	['$B'] = 'template content',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
p[''] = function ( frame )&lt;br /&gt;
	if not frame:getParent() then&lt;br /&gt;
		error( '{{#invoke:Unsubst|}} makes no sense without a parent frame' )&lt;br /&gt;
	end&lt;br /&gt;
	if not frame.args['$B'] then&lt;br /&gt;
		error( '{{#invoke:Unsubst|}} requires parameter $B (template content)' )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if mw.isSubsting() then&lt;br /&gt;
		---- substing&lt;br /&gt;
		-- Combine passed args with passed defaults&lt;br /&gt;
		local args = {}&lt;br /&gt;
		for k, v in pairs( frame.args ) do&lt;br /&gt;
			if not specialParams[k] then&lt;br /&gt;
				if v == '__DATE__' then&lt;br /&gt;
					v = mw.getContentLanguage():formatDate( 'F Y' )&lt;br /&gt;
				end&lt;br /&gt;
				args[k] = v&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for k, v in pairs( frame:getParent().args ) do&lt;br /&gt;
			args[k] = v&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Build an equivalent template invocation&lt;br /&gt;
		-- First, find the title to use&lt;br /&gt;
		local titleobj = mw.title.new(frame:getParent():getTitle())&lt;br /&gt;
		local title&lt;br /&gt;
		if titleobj.namespace == 10 then -- NS_TEMPLATE&lt;br /&gt;
			title = titleobj.text&lt;br /&gt;
		elseif titleobj.namespace == 0 then -- NS_MAIN&lt;br /&gt;
			title = ':' .. titleobj.text&lt;br /&gt;
		else&lt;br /&gt;
			title = titleobj.prefixedText&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Build the invocation body with numbered args first, then named&lt;br /&gt;
		local ret = '{{' .. title&lt;br /&gt;
		for k, v in ipairs( args ) do&lt;br /&gt;
			if string.find( v, '=', 1, true ) then&lt;br /&gt;
				-- likely something like 1=foo=bar, we need to do it as a named arg&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
			ret = ret .. '|' .. v&lt;br /&gt;
			args[k] = nil&lt;br /&gt;
		end&lt;br /&gt;
		for k, v in pairs( args ) do&lt;br /&gt;
			ret = ret .. '|' .. k .. '=' .. v&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return ret .. '}}'&lt;br /&gt;
	else&lt;br /&gt;
		---- Not substing&lt;br /&gt;
		-- Just return the &amp;quot;body&amp;quot;&lt;br /&gt;
		return frame.args['$B'] .. (frame.args['$N'] and frame:getParent():getTitle() == mw.title.getCurrentTitle().prefixedText and '[[Category:Calls to Module:Unsubst that use $N]]' or '')&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Shawndouglas</name></author>
	</entry>
</feed>