<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.stiles.casa/index.php?action=history&amp;feed=atom&amp;title=Module%3ATeam_appearances_list%2Fshow%2Fsandbox</id>
	<title>Module:Team appearances list/show/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stiles.casa/index.php?action=history&amp;feed=atom&amp;title=Module%3ATeam_appearances_list%2Fshow%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://wiki.stiles.casa/index.php?title=Module:Team_appearances_list/show/sandbox&amp;action=history"/>
	<updated>2026-05-07T03:36:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://wiki.stiles.casa/index.php?title=Module:Team_appearances_list/show/sandbox&amp;diff=7821&amp;oldid=prev</id>
		<title>imported&gt;Johnuniq: copy from Module:Team appearances list/show to show sandbox data</title>
		<link rel="alternate" type="text/html" href="https://wiki.stiles.casa/index.php?title=Module:Team_appearances_list/show/sandbox&amp;diff=7821&amp;oldid=prev"/>
		<updated>2016-11-26T03:40:15Z</updated>

		<summary type="html">&lt;p&gt;copy from &lt;a href=&quot;/view/Module:Team_appearances_list/show&quot; title=&quot;Module:Team appearances list/show&quot;&gt;Module:Team appearances list/show&lt;/a&gt; to show sandbox data&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- For testing, show results using data from [[Module:Team appearances list/data]].&lt;br /&gt;
&lt;br /&gt;
local Collection = {}&lt;br /&gt;
Collection.__index = Collection&lt;br /&gt;
do&lt;br /&gt;
	function Collection:add(item)&lt;br /&gt;
		if item ~= nil then&lt;br /&gt;
			self.n = self.n + 1&lt;br /&gt;
			self[self.n] = item&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	function Collection:join(sep)&lt;br /&gt;
		return table.concat(self, sep)&lt;br /&gt;
	end&lt;br /&gt;
	function Collection:sort(comp)&lt;br /&gt;
		table.sort(self, comp)&lt;br /&gt;
	end&lt;br /&gt;
	function Collection.new()&lt;br /&gt;
		return setmetatable({n = 0}, Collection)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_page_content(page_title)&lt;br /&gt;
	local t = mw.title.new(page_title)&lt;br /&gt;
	if t then&lt;br /&gt;
		local content = t:getContent()&lt;br /&gt;
		if content then&lt;br /&gt;
			if content:sub(-1) ~= &amp;#039;\n&amp;#039; then&lt;br /&gt;
				content = content .. &amp;#039;\n&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
			return content&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	error(&amp;#039;Could not read wikitext from &amp;quot;[[&amp;#039; .. page_title .. &amp;#039;]]&amp;quot;.&amp;#039;, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function make_data(modname)&lt;br /&gt;
	-- Return a list of tables for each competition/team in the order used in&lt;br /&gt;
	-- the data module, based on a hope that the data module is consistently&lt;br /&gt;
	-- indented with one tab before competitions and two or more before teams,&lt;br /&gt;
	-- and quotes (&amp;quot;) are used for strings (not apostrophes).&lt;br /&gt;
	local content = get_page_content(modname)&lt;br /&gt;
	local lnum = 0&lt;br /&gt;
	local current_games&lt;br /&gt;
	local items = Collection.new()&lt;br /&gt;
	for line in string.gmatch(content, &amp;#039;(.-)\n&amp;#039;) do&lt;br /&gt;
		lnum = lnum + 1&lt;br /&gt;
		local indent, title = line:match(&amp;#039;^(\t+)%[&amp;quot;(.-)&amp;quot;%]&amp;#039;)&lt;br /&gt;
		if indent then&lt;br /&gt;
			if indent == &amp;#039;\t&amp;#039; then&lt;br /&gt;
				current_games = title&lt;br /&gt;
			else&lt;br /&gt;
				items:add({&lt;br /&gt;
					competition = current_games,&lt;br /&gt;
					team = title,&lt;br /&gt;
					line = lnum,&lt;br /&gt;
				})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return items&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(frame)&lt;br /&gt;
	local title = frame.args[1]&lt;br /&gt;
	if title == nil or title == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;Error: Parameter 1 must specify name of data module&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local sandbox = title:find(&amp;#039;sandbox&amp;#039;, 1, true) and &amp;#039;/sandbox&amp;#039; or &amp;#039;&amp;#039;&lt;br /&gt;
	local lister = require(&amp;#039;Module:Team appearances list&amp;#039; .. sandbox)._main&lt;br /&gt;
	local lines = Collection.new()&lt;br /&gt;
	local current_games&lt;br /&gt;
	for _, item in ipairs(make_data(title)) do&lt;br /&gt;
		if current_games ~= item.competition then&lt;br /&gt;
			current_games = item.competition&lt;br /&gt;
			lines:add(&amp;#039;==&amp;#039; .. current_games .. &amp;#039;==&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		lines:add(item.team .. &amp;#039; (line &amp;#039; .. item.line .. &amp;#039;) &amp;#039; .. lister(item))&lt;br /&gt;
	end&lt;br /&gt;
	return lines:join(&amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return { main = main }&lt;/div&gt;</summary>
		<author><name>imported&gt;Johnuniq</name></author>
	</entry>
</feed>