<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3AIndent</id>
	<title>Module:Indent - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3AIndent"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Indent&amp;action=history"/>
	<updated>2026-04-10T14:08:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Module:Indent&amp;diff=12221&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;local p = {}  function p.indent(frame)     -- Trim whitespace from the arguments and remove blank values.     local args = {}     if type(frame.args) == &#039;table&#039; then         f...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:Indent&amp;diff=12221&amp;oldid=prev"/>
		<updated>2020-10-18T18:04:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  function p.indent(frame)     -- Trim whitespace from the arguments and remove blank values.     local args = {}     if type(frame.args) == &amp;#039;table&amp;#039; then         f...&amp;quot;&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.indent(frame)&lt;br /&gt;
    -- Trim whitespace from the arguments and remove blank values.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    if type(frame.args) == &amp;#039;table&amp;#039; then&lt;br /&gt;
        for k, v in pairs( frame.args ) do&lt;br /&gt;
            v = mw.text.trim(v)&lt;br /&gt;
            if v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
                args[k] = v&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Set variables.&lt;br /&gt;
    local indent = tonumber( args[1] )&lt;br /&gt;
    local br = args[2]&lt;br /&gt;
    local ret = &amp;#039;&amp;#039;&lt;br /&gt;
    &lt;br /&gt;
    -- Insert line breaks to match the functionality of the original template.&lt;br /&gt;
    -- If &amp;quot;br&amp;quot; is set, we need two line breaks; if not, we just need one.&lt;br /&gt;
    if br then&lt;br /&gt;
        ret = ret .. &amp;#039;&amp;lt;br /&amp;gt;&amp;#039; &lt;br /&gt;
    end&lt;br /&gt;
    ret = ret .. &amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&lt;br /&gt;
    &lt;br /&gt;
    -- Control for bad or zero input. If found, output the line breaks only, &lt;br /&gt;
    -- as this was the previous behaviour of the template.&lt;br /&gt;
    if not indent or indent &amp;lt;= 0 or math.floor(indent) ~= indent then&lt;br /&gt;
        return ret&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Generate the indents. The first four cases are special.&lt;br /&gt;
    if indent == 1 then&lt;br /&gt;
        return ret .. &amp;#039;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
    elseif indent == 2 then&lt;br /&gt;
        return ret .. &amp;#039;&amp;amp;nbsp;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
    elseif indent == 3 then&lt;br /&gt;
        return ret .. &amp;#039;&amp;amp;nbsp;&amp;amp;emsp;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
    elseif indent == 4 then&lt;br /&gt;
        return ret .. &amp;#039;&amp;amp;nbsp; &amp;amp;emsp; &amp;amp;nbsp;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Set variables for generating the output after indent == 5.&lt;br /&gt;
    local r = {}&lt;br /&gt;
    r.base = &amp;#039;&amp;amp;nbsp;&amp;#039; -- Common text to all output.&lt;br /&gt;
    r.rep = &amp;#039; &amp;amp;emsp; &amp;amp;nbsp;&amp;#039; -- The text to repeat.&lt;br /&gt;
    r.mod1 = &amp;#039;&amp;amp;nbsp;&amp;#039; -- To return on modulo 1.&lt;br /&gt;
    r.mod2 = &amp;#039; &amp;amp;emsp;&amp;#039; -- To return on modulo 2.&lt;br /&gt;
    r.mod3 = &amp;#039; &amp;amp;emsp;&amp;amp;nbsp;&amp;#039; -- To return on modulo 3.&lt;br /&gt;
    &lt;br /&gt;
    -- New iteratorText values needed at 5, 9, 13, 17, etc., so repeat the&lt;br /&gt;
    -- text (indent - 1)/4 times and find the remainder.&lt;br /&gt;
    local reps = math.floor( (indent - 1) / 4 )&lt;br /&gt;
    local remainder = math.fmod( indent - 1, 4 )&lt;br /&gt;
    &lt;br /&gt;
    -- Generate the indent text.&lt;br /&gt;
    ret = ret .. r.base .. mw.ustring.rep( r.rep, reps )&lt;br /&gt;
    if remainder &amp;gt;= 1 and remainder &amp;lt;= 3 then&lt;br /&gt;
        ret = ret .. r[ &amp;#039;mod&amp;#039; .. remainder ]&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>