<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wikimedia.vm2.hel1.fi.cometa.se/index.php?action=history&amp;feed=atom&amp;title=Module%3AFor_batched_parameters</id>
	<title>Module:For batched parameters - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikimedia.vm2.hel1.fi.cometa.se/index.php?action=history&amp;feed=atom&amp;title=Module%3AFor_batched_parameters"/>
	<link rel="alternate" type="text/html" href="https://wikimedia.vm2.hel1.fi.cometa.se/index.php?title=Module:For_batched_parameters&amp;action=history"/>
	<updated>2026-10-20T15:55:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wikimedia.vm2.hel1.fi.cometa.se/index.php?title=Module:For_batched_parameters&amp;diff=510&amp;oldid=prev</id>
		<title>Theo: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wikimedia.vm2.hel1.fi.cometa.se/index.php?title=Module:For_batched_parameters&amp;diff=510&amp;oldid=prev"/>
		<updated>2026-10-20T13:25:18Z</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-interface=&quot;&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-GB&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 13:25, 20 October 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wiki_wikimedia-wiki_new_:diff:1.41:old-509:rev-510 --&gt;
&lt;/table&gt;</summary>
		<author><name>Theo</name></author>
	</entry>
	<entry>
		<id>https://wikimedia.vm2.hel1.fi.cometa.se/index.php?title=Module:For_batched_parameters&amp;diff=509&amp;oldid=prev</id>
		<title>wikipedia&gt;Chrisahn: handle parameters with defaults; copied from current version of sandbox</title>
		<link rel="alternate" type="text/html" href="https://wikimedia.vm2.hel1.fi.cometa.se/index.php?title=Module:For_batched_parameters&amp;diff=509&amp;oldid=prev"/>
		<updated>2026-07-03T21:07:16Z</updated>

		<summary type="html">&lt;p&gt;handle parameters with defaults; copied from current version of sandbox&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;
-- Find &amp;quot;{{{x|&amp;quot; where &amp;quot;x&amp;quot; is an arg name&lt;br /&gt;
local function findDefStart (code, i, argstosub)&lt;br /&gt;
    while true do&lt;br /&gt;
        local s, e, a = code:find(&amp;quot;{{{([^{}|]+)|&amp;quot;, i)&lt;br /&gt;
        if not s then return nil end&lt;br /&gt;
        if argstosub[a] then return s, e, a end&lt;br /&gt;
        i = e + 1&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Skip stuff after &amp;quot;{{{x|&amp;quot;, find &amp;quot;}}}&amp;quot;&lt;br /&gt;
local function findDefEnd (code, i)&lt;br /&gt;
    while true do&lt;br /&gt;
        local s, e = code:find(&amp;quot;^[^{}]*&amp;quot;, i)  -- skip non-braces&lt;br /&gt;
        i = e + 1&lt;br /&gt;
        s, e = code:find(&amp;quot;^%b{}&amp;quot;, i)  -- skip balanced braces&lt;br /&gt;
        if not s then break end&lt;br /&gt;
        i = e + 1&lt;br /&gt;
    end&lt;br /&gt;
    return code:find(&amp;quot;^}}}&amp;quot;, i) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Replace &amp;quot;{{{x|...}}}&amp;quot; by &amp;quot;{{{x}}}&amp;quot; where &amp;quot;x&amp;quot; is an arg name.&lt;br /&gt;
-- Without this, we&amp;#039;d have to handle both &amp;quot;{{{x}}}&amp;quot; and &amp;quot;{{{x|...}}}&amp;quot;&lt;br /&gt;
-- in the main loop, which would be cumbersome and inefficient.&lt;br /&gt;
-- All but the last batch are guaranteed to have the full size,&lt;br /&gt;
-- so we know that the parameters don&amp;#039;t need defaults.&lt;br /&gt;
local function dropDefs (code, size)&lt;br /&gt;
	local argstosub = {}&lt;br /&gt;
	argstosub[&amp;quot;i&amp;quot;] = &amp;quot;{{{i}}}&amp;quot;&lt;br /&gt;
	for i = 1, size do&lt;br /&gt;
		argstosub[tostring(i)] = &amp;quot;{{{&amp;quot; .. i .. &amp;quot;}}}&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    local result = {}&lt;br /&gt;
    local i = 1&lt;br /&gt;
    while true do&lt;br /&gt;
        local s, e, a = findDefStart(code, i, argstosub)&lt;br /&gt;
        if not s then break end  -- no more &amp;quot;{{{x|&amp;quot;, done&lt;br /&gt;
        _, e = findDefEnd(code, e + 1)&lt;br /&gt;
        if not e then break end  -- no &amp;quot;}}}&amp;quot;, bad syntax, let wiki deal with it&lt;br /&gt;
        table.insert(result, code:sub(i, s - 1))  -- append up to &amp;quot;{{{x|&amp;quot;&lt;br /&gt;
        table.insert(result, argstosub[a])  -- append &amp;quot;{{{x}}}&amp;quot;&lt;br /&gt;
        i = e + 1&lt;br /&gt;
    end&lt;br /&gt;
    table.insert(result, code:sub(i))&lt;br /&gt;
	return table.concat(result)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame) &lt;br /&gt;
	local size = tonumber(frame.args[1])&lt;br /&gt;
	local sep = frame.args[2]&lt;br /&gt;
	local code = frame.args[3] or frame.args.code&lt;br /&gt;
	local result = {}&lt;br /&gt;
	local batch = {}&lt;br /&gt;
	code = mw.text.unstripNoWiki(code)&lt;br /&gt;
	code = 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;
	local cleanCode = dropDefs(code, size)&lt;br /&gt;
	local idx = 0&lt;br /&gt;
	for i, value in ipairs(frame:getParent().args) do&lt;br /&gt;
		table.insert(batch, value)&lt;br /&gt;
		if #batch == size then&lt;br /&gt;
			idx = idx + 1&lt;br /&gt;
			local argstosub = {}&lt;br /&gt;
			for j, value2 in pairs(batch) do&lt;br /&gt;
				argstosub[tostring(j)] = value2&lt;br /&gt;
			end&lt;br /&gt;
			argstosub[&amp;quot;i&amp;quot;] = idx&lt;br /&gt;
			local actualCode = cleanCode:gsub(&amp;quot;{{{([^{}]+)}}}&amp;quot;, argstosub)&lt;br /&gt;
			table.insert(result, frame:preprocess(actualCode))&lt;br /&gt;
			batch = {}&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if #batch &amp;gt; 0 then&lt;br /&gt;
		idx = idx + 1&lt;br /&gt;
		local argstosub = {}&lt;br /&gt;
		for j, value2 in pairs(batch) do&lt;br /&gt;
			argstosub[tostring(j)] = value2&lt;br /&gt;
		end&lt;br /&gt;
		argstosub[&amp;quot;i&amp;quot;] = idx&lt;br /&gt;
		-- Do the last sub in a child frame and use the original code to handle defaults&lt;br /&gt;
		local childFrame = frame:newChild{title=frame:getParent().title, args = argstosub}&lt;br /&gt;
		table.insert(result, childFrame:preprocess(code))&lt;br /&gt;
	end&lt;br /&gt;
	if frame.args.conjunction then&lt;br /&gt;
		return mw.text.listToText(result, sep, frame.args.conjunction)&lt;br /&gt;
	else&lt;br /&gt;
		return table.concat(result, sep)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Chrisahn</name></author>
	</entry>
</feed>