<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AArgRest</id>
	<title>Module:ArgRest - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AArgRest"/>
	<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:ArgRest&amp;action=history"/>
	<updated>2026-10-31T12:51:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://elite.mistflux.co.uk/w/index.php?title=Module:ArgRest&amp;diff=111492&amp;oldid=prev</id>
		<title>Wikipedia&gt;Lemondoge: enclose the pipe capture in a separate thingamajig</title>
		<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:ArgRest&amp;diff=111492&amp;oldid=prev"/>
		<updated>2023-05-11T14:20:21Z</updated>

		<summary type="html">&lt;p&gt;enclose the pipe capture in a separate thingamajig&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;
function p.main(frame)&lt;br /&gt;
	-- Undo sanitization:&lt;br /&gt;
	local code = frame.args[1] or &amp;#039;&amp;#039;&lt;br /&gt;
	if code:match&amp;#039;nowiki&amp;#039; then&lt;br /&gt;
		code = mw.text.unstripNoWiki(code)&lt;br /&gt;
	else error(&amp;quot;&amp;lt;nowiki&amp;gt; missing from first parameter&amp;quot;) end&lt;br /&gt;
	&lt;br /&gt;
	-- Angle brackets still remain santiized; unsanitize them&lt;br /&gt;
	local wikitext = code:gsub(&amp;#039;&amp;amp;lt;&amp;#039;, &amp;#039;&amp;lt;&amp;#039;):gsub(&amp;#039;&amp;amp;gt;&amp;#039;, &amp;#039;&amp;gt;&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local secondParam = frame.args[2]&lt;br /&gt;
    local start = tonumber(secondParam:match(&amp;#039;%d+&amp;#039;)) -- Extract the first number from the second parameter&lt;br /&gt;
    local result = &amp;#039;&amp;#039;&lt;br /&gt;
    &lt;br /&gt;
    assert(secondParam, &amp;quot;second parameter missing&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    local function replaceTripleBraces(parameter, _, default, i) -- extract corresponding arguments from the parent function. the _ is necessary because the pipe still gets caught in the second capture group&lt;br /&gt;
    	if _ == &amp;quot;&amp;quot; then default = nil end -- mildly ugly hack for checking for {{{parameter|}}}&lt;br /&gt;
		return frame:getParent().args[parameter:gsub(&amp;quot;%d+&amp;quot;, tostring(i))] or default or &amp;quot;{{{&amp;quot; .. parameter .. &amp;quot;}}}&amp;quot;&lt;br /&gt;
    end &lt;br /&gt;
    &lt;br /&gt;
    for i = start, math.huge do&lt;br /&gt;
        -- Check if the parameter is defined&lt;br /&gt;
        if not frame:getParent().args[secondParam:gsub(&amp;#039;%d+&amp;#039;, tostring(i))] then &lt;br /&gt;
        	break&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        local processed = wikitext:gsub(&amp;quot;{{{([^{}&amp;lt;&amp;gt;|]+)(|?)([^{}|]*)}}}&amp;quot;, function(a, b, c) return replaceTripleBraces(a, b, c, i) end) -- Find stuff of the form {{{parameter}}} or {{{parameter|default}}} via pattern matching&lt;br /&gt;
        result = result .. processed&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return frame:preprocess(result)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Lemondoge</name></author>
	</entry>
</feed>