<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://eoa.aitzazimtiaz.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3APseudocode</id>
	<title>Module:Pseudocode - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://eoa.aitzazimtiaz.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3APseudocode"/>
	<link rel="alternate" type="text/html" href="https://eoa.aitzazimtiaz.xyz/index.php?title=Module:Pseudocode&amp;action=history"/>
	<updated>2026-08-05T23:59:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://eoa.aitzazimtiaz.xyz/index.php?title=Module:Pseudocode&amp;diff=28&amp;oldid=prev</id>
		<title>Aitzaz: Module for CLRS style pseudocode.</title>
		<link rel="alternate" type="text/html" href="https://eoa.aitzazimtiaz.xyz/index.php?title=Module:Pseudocode&amp;diff=28&amp;oldid=prev"/>
		<updated>2026-08-03T23:13:29Z</updated>

		<summary type="html">&lt;p&gt;Module for CLRS style pseudocode.&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;
local keywords = {&lt;br /&gt;
	[&amp;#039;for&amp;#039;] = true, [&amp;#039;to&amp;#039;] = true, [&amp;#039;downto&amp;#039;] = true, [&amp;#039;while&amp;#039;] = true,&lt;br /&gt;
	[&amp;#039;repeat&amp;#039;] = true, [&amp;#039;until&amp;#039;] = true, [&amp;#039;if&amp;#039;] = true, [&amp;#039;then&amp;#039;] = true,&lt;br /&gt;
	[&amp;#039;else&amp;#039;] = true, [&amp;#039;elseif&amp;#039;] = true, [&amp;#039;do&amp;#039;] = true, [&amp;#039;return&amp;#039;] = true,&lt;br /&gt;
	[&amp;#039;and&amp;#039;] = true, [&amp;#039;or&amp;#039;] = true, [&amp;#039;not&amp;#039;] = true, [&amp;#039;break&amp;#039;] = true,&lt;br /&gt;
	[&amp;#039;each&amp;#039;] = true, [&amp;#039;in&amp;#039;] = true, [&amp;#039;error&amp;#039;] = true, [&amp;#039;nil&amp;#039;] = true,&lt;br /&gt;
	[&amp;#039;true&amp;#039;] = true, [&amp;#039;false&amp;#039;] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local LT, GT, AMP, HYP = &amp;#039;\1&amp;#039;, &amp;#039;\2&amp;#039;, &amp;#039;\3&amp;#039;, &amp;#039;\4&amp;#039;&lt;br /&gt;
local DASH = &amp;#039;\45&amp;#039;&lt;br /&gt;
&lt;br /&gt;
local function levelOf(line)&lt;br /&gt;
	local tabs = line:match(&amp;#039;^(\t*)&amp;#039;)&lt;br /&gt;
	if #tabs &amp;gt; 0 then&lt;br /&gt;
		return #tabs&lt;br /&gt;
	end&lt;br /&gt;
	return math.floor(#(line:match(&amp;#039;^( *)&amp;#039;)) / 4)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function classify(word)&lt;br /&gt;
	local isProc = word:find(HYP, 1, true) ~= nil&lt;br /&gt;
	local plain = word:gsub(HYP, DASH)&lt;br /&gt;
	local lower = mw.ustring.lower(plain)&lt;br /&gt;
	if keywords[lower] then&lt;br /&gt;
		return &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;quot; .. lower .. &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if isProc or (mw.ustring.len(plain) &amp;gt; 1 and plain:match(&amp;#039;^%u%l&amp;#039;)) then&lt;br /&gt;
		return &amp;#039;&amp;lt;span class=&amp;quot;eoa-proc&amp;quot;&amp;gt;&amp;#039; .. plain .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;&amp;#039; .. plain .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatLine(line)&lt;br /&gt;
	local out = line:gsub(&amp;#039;^[ \t]+&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	out = out:gsub(&amp;#039;&amp;amp;&amp;#039;, AMP):gsub(&amp;#039;&amp;lt;&amp;#039;, LT):gsub(&amp;#039;&amp;gt;&amp;#039;, GT)&lt;br /&gt;
	out = out:gsub(&amp;#039;(%a)%-(%a)&amp;#039;, &amp;#039;%1&amp;#039; .. HYP .. &amp;#039;%2&amp;#039;)&lt;br /&gt;
	out = out:gsub(&amp;#039;%a[%w&amp;#039; .. HYP .. &amp;#039;]*&amp;#039;, classify)&lt;br /&gt;
	out = out:gsub(AMP, &amp;#039;&amp;amp;amp;&amp;#039;):gsub(LT, &amp;#039;&amp;amp;lt;&amp;#039;):gsub(GT, &amp;#039;&amp;amp;gt;&amp;#039;)&lt;br /&gt;
	return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.line(frame)&lt;br /&gt;
	local text = frame.args[1] or &amp;#039;&amp;#039;&lt;br /&gt;
	if text == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return formatLine(text)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.render(frame)&lt;br /&gt;
	local code = frame:getParent().args.code or &amp;#039;&amp;#039;&lt;br /&gt;
	local list = mw.html.create(&amp;#039;ol&amp;#039;)&lt;br /&gt;
	for raw in code:gmatch(&amp;#039;[^\n]+&amp;#039;) do&lt;br /&gt;
		if raw:match(&amp;#039;%S&amp;#039;) then&lt;br /&gt;
			local item = list:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
			local depth = levelOf(raw)&lt;br /&gt;
			if depth &amp;gt; 0 then&lt;br /&gt;
				item:tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;display&amp;#039;, &amp;#039;inline-block&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;width&amp;#039;, (depth * 1.7) .. &amp;#039;em&amp;#039;)&lt;br /&gt;
					:done()&lt;br /&gt;
			end&lt;br /&gt;
			item:wikitext(formatLine(raw))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return tostring(list)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Aitzaz</name></author>
	</entry>
</feed>