<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Atemplate_parser%2Ftemplates</id>
	<title>Module:template parser/templates - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Atemplate_parser%2Ftemplates"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:template_parser/templates&amp;action=history"/>
	<updated>2026-05-23T03:43:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:template_parser/templates&amp;diff=474915&amp;oldid=prev</id>
		<title>Sware: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:template_parser/templates&amp;diff=474915&amp;oldid=prev"/>
		<updated>2025-11-04T17:47:19Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:47, 4 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:template_parser/templates&amp;diff=474914&amp;oldid=prev</id>
		<title>wikt&gt;SurjectionBot: (bot) slight optimization to 5.2 compat: prefer unpack to table.unpack</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:template_parser/templates&amp;diff=474914&amp;oldid=prev"/>
		<updated>2025-04-24T12:26:46Z</updated>

		<summary type="html">&lt;p&gt;(bot) slight optimization to 5.2 compat: prefer unpack to table.unpack&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Prevent substitution.&lt;br /&gt;
if mw.isSubsting() then&lt;br /&gt;
	return require(&amp;quot;Module:unsubst&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local export = {}&lt;br /&gt;
&lt;br /&gt;
local m_template_parser = require(&amp;quot;Module:template parser&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local display_parameter = m_template_parser.displayParameter&lt;br /&gt;
local process_params = require(&amp;quot;Module:parameters&amp;quot;).process&lt;br /&gt;
local template_link = m_template_parser.templateLink&lt;br /&gt;
local unpack = unpack or table.unpack -- Lua 5.2 compatibility&lt;br /&gt;
local wikitag_link = m_template_parser.wikitagLink&lt;br /&gt;
&lt;br /&gt;
local function get_offset_template_args(frame)&lt;br /&gt;
	-- Process parameters with the return_unknown flag set. `title` contains&lt;br /&gt;
	-- the title at key 1; everything else goes in `args`.&lt;br /&gt;
	local title, args = process_params(frame:getParent().args, {&lt;br /&gt;
		[1] = {required = true, allow_empty = true, no_trim = true}&lt;br /&gt;
	}, true)&lt;br /&gt;
	title = title[1]&lt;br /&gt;
	-- Shift all implicit arguments down by 1. Non-sequential numbered&lt;br /&gt;
	-- parameters don&amp;#039;t get shifted; however, this offset means that if the&lt;br /&gt;
	-- input contains (e.g.) {{tl|l|en|3=alt}}, representing {{l|en|3=alt}},&lt;br /&gt;
	-- the parameter at 3= is instead treated as sequential by this module,&lt;br /&gt;
	-- because it&amp;#039;s indistinguishable from {{tl|l|en|alt}}, which represents&lt;br /&gt;
	-- {{l|en|alt}}. On the other hand, {{tl|l|en|4=tr}} is handled correctly,&lt;br /&gt;
	-- because there&amp;#039;s still a gap before 4=.&lt;br /&gt;
	-- Unfortunately, there&amp;#039;s no way to know the original input, so&lt;br /&gt;
	-- there&amp;#039;s no clear way to fix this; the only difference is that explicit&lt;br /&gt;
	-- parameters have whitespace trimmed from their values while implicit ones&lt;br /&gt;
	-- don&amp;#039;t, but we can&amp;#039;t assume that every input with no whitespace was given&lt;br /&gt;
	-- with explicit numbering.&lt;br /&gt;
	-- This also causes bigger problems for any parser functions which treat&lt;br /&gt;
	-- their inputs as arrays, or in some other nonstandard way (e.g.&lt;br /&gt;
	-- {{#IF:foo|bar=baz|qux}} treats &amp;quot;bar=baz&amp;quot; as parameter 1). Without&lt;br /&gt;
	-- knowing the original input, these can&amp;#039;t be reconstructed accurately.&lt;br /&gt;
	-- The way around this is to use &amp;lt;nowiki&amp;gt; tags in the input, since this&lt;br /&gt;
	-- module won&amp;#039;t unstrip them by design.&lt;br /&gt;
	local i = 2&lt;br /&gt;
	repeat&lt;br /&gt;
		local arg = args[i]&lt;br /&gt;
		args[i - 1] = arg&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	until arg == nil&lt;br /&gt;
	return title, args&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.template_link_t(frame)&lt;br /&gt;
	local iargs = process_params(frame.args, {&lt;br /&gt;
		[&amp;quot;annotate&amp;quot;] = true,&lt;br /&gt;
		[&amp;quot;nolink&amp;quot;] = {type = &amp;quot;boolean&amp;quot;},&lt;br /&gt;
	})&lt;br /&gt;
	-- iargs.annotate allows a template to specify the title, so the input&lt;br /&gt;
	-- arguments will match the output.&lt;br /&gt;
	local title = iargs.annotate&lt;br /&gt;
	if title then&lt;br /&gt;
		return template_link(title, frame:getParent().args, iargs.nolink)&lt;br /&gt;
	end&lt;br /&gt;
	-- Otherwise, get template arguments offset by 1.&lt;br /&gt;
	local args&lt;br /&gt;
	title, args = get_offset_template_args(frame)&lt;br /&gt;
	return template_link(title, args, iargs.nolink)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.template_demo_t(frame)&lt;br /&gt;
	local title, args = get_offset_template_args(frame)&lt;br /&gt;
	return template_link(title, args) .. &amp;quot; ⇒&amp;lt;br style=\&amp;quot;line-height: 200%;\&amp;quot; /&amp;gt;&amp;quot; .. frame:expandTemplate{title = title, args = args}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.parameter_t(frame)&lt;br /&gt;
	return display_parameter(unpack(process_params(frame:getParent().args, {&lt;br /&gt;
		[1] = {required = true, allow_empty = true, no_trim = true},&lt;br /&gt;
		[2] = {allow_empty = true, no_trim = true},&lt;br /&gt;
	})))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.wikitag_link_t(frame)&lt;br /&gt;
	return wikitag_link(process_params(frame:getParent().args, {&lt;br /&gt;
		[1] = {required = true, allow_empty = true, no_trim = true}&lt;br /&gt;
	})[1])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>wikt&gt;SurjectionBot</name></author>
	</entry>
</feed>