<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AUser%2Fsandbox</id>
	<title>Module:User/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AUser%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:User/sandbox&amp;action=history"/>
	<updated>2026-04-22T10:10:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:User/sandbox&amp;diff=147510&amp;oldid=prev</id>
		<title>imported&gt;Pppery: Create sandbox version of Module:User</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:User/sandbox&amp;diff=147510&amp;oldid=prev"/>
		<updated>2021-10-06T19:01:42Z</updated>

		<summary type="html">&lt;p&gt;Create sandbox version of &lt;a href=&quot;/research/Module:User&quot; title=&quot;Module:User&quot;&gt;Module:User&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[=[&lt;br /&gt;
-- This module implements {{user}}. {{user}} is a high-use template, sometimes&lt;br /&gt;
-- with thousands of transclusions on a page. This module optimises the&lt;br /&gt;
-- template&amp;#039;s performance by reducing the number of parameters called from&lt;br /&gt;
-- wikitext, while still allowing all the features provided by&lt;br /&gt;
-- [[Module:UserLinks]]. It is about twice as fast as the version of {{user}}&lt;br /&gt;
-- that called the {{user-multi}} template from wikitext.&lt;br /&gt;
--]=]&lt;br /&gt;
&lt;br /&gt;
local mUserLinks = require(&amp;#039;Module:UserLinks&amp;#039;)&lt;br /&gt;
local mShared = require(&amp;#039;Module:UserLinks/shared&amp;#039;)&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function validateArg(arg)&lt;br /&gt;
	-- Validates one argument. Whitespace is stripped, and blank arguments&lt;br /&gt;
	-- are treated as nil.&lt;br /&gt;
	if not arg then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	arg = arg:match(&amp;#039;^%s*(.-)%s*$&amp;#039;)&lt;br /&gt;
	if arg ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		return arg&lt;br /&gt;
	else&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	-- Grab the user, project and lang args from wikitext.&lt;br /&gt;
	local argKeys = {&lt;br /&gt;
		user = {&lt;br /&gt;
			1,&lt;br /&gt;
			&amp;#039;User&amp;#039;,&lt;br /&gt;
			&amp;#039;user&amp;#039;&lt;br /&gt;
		},&lt;br /&gt;
		project = {&lt;br /&gt;
			2,&lt;br /&gt;
			&amp;#039;Project&amp;#039;,&lt;br /&gt;
			&amp;#039;project&amp;#039;&lt;br /&gt;
		},&lt;br /&gt;
		lang = {&lt;br /&gt;
			3,&lt;br /&gt;
			&amp;#039;Lang&amp;#039;,&lt;br /&gt;
			&amp;#039;lang&amp;#039;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	local origArgs = frame:getParent().args&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for argKey, t in pairs(argKeys) do&lt;br /&gt;
		for i, origArgKey in ipairs(t) do&lt;br /&gt;
			local value = origArgs[origArgKey]&lt;br /&gt;
			value = validateArg(value)&lt;br /&gt;
			if value then&lt;br /&gt;
				args[argKey] = value&lt;br /&gt;
				-- If we have found a value, break the loop. For the average&lt;br /&gt;
				-- invocation this saves two argument lookups.&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Generate options. Some of these need wikitext args also.&lt;br /&gt;
	local options = {&lt;br /&gt;
		span = false,&lt;br /&gt;
		separator = validateArg(origArgs.separator) or &amp;#039;dot&amp;#039;,&lt;br /&gt;
		isDemo = yesno(validateArg(origArgs.demo))&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	-- Input the codes directly. This saves two argument lookups for each&lt;br /&gt;
	-- invocation.&lt;br /&gt;
	local codes = {&amp;#039;t&amp;#039;, &amp;#039;c&amp;#039;}&lt;br /&gt;
	&lt;br /&gt;
	-- Plug the data into [[Module:UserLinks]].&lt;br /&gt;
	local snippets = mUserLinks.getSnippets(args)&lt;br /&gt;
	local links = mUserLinks.getLinks(snippets)&lt;br /&gt;
	local success, result = pcall(mUserLinks.export, codes, links, options)&lt;br /&gt;
	if success then&lt;br /&gt;
		return result&lt;br /&gt;
	else&lt;br /&gt;
		return mShared.makeWikitextError(result, options.isDemo)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Pppery</name></author>
	</entry>
</feed>