<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.railos.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACountryData</id>
	<title>Module:CountryData - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.railos.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACountryData"/>
	<link rel="alternate" type="text/html" href="https://wiki.railos.org/index.php?title=Module:CountryData&amp;action=history"/>
	<updated>2026-04-06T03:29:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://wiki.railos.org/index.php?title=Module:CountryData&amp;diff=4234&amp;oldid=prev</id>
		<title>Oxalin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.railos.org/index.php?title=Module:CountryData&amp;diff=4234&amp;oldid=prev"/>
		<updated>2023-07-15T21:13:28Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&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 21:13, 15 July 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key ros_wiki:diff::1.12:old-4233:rev-4234 --&gt;
&lt;/table&gt;</summary>
		<author><name>Oxalin</name></author>
	</entry>
	<entry>
		<id>https://wiki.railos.org/index.php?title=Module:CountryData&amp;diff=4233&amp;oldid=prev</id>
		<title>en&gt;GKFX: Add optional caching layer for most-used templates via loadData. Reduces rendering time as tested on List_of_twin_towns_and_sister_cities_in_Germany</title>
		<link rel="alternate" type="text/html" href="https://wiki.railos.org/index.php?title=Module:CountryData&amp;diff=4233&amp;oldid=prev"/>
		<updated>2021-05-05T20:40:05Z</updated>

		<summary type="html">&lt;p&gt;Add optional caching layer for most-used templates via loadData. Reduces rendering time as tested on &lt;a href=&quot;/index.php?title=List_of_twin_towns_and_sister_cities_in_Germany&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;List of twin towns and sister cities in Germany (page does not exist)&quot;&gt;List_of_twin_towns_and_sister_cities_in_Germany&lt;/a&gt;&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;
local mostUsed = mw.loadData(&amp;#039;Module:CountryData/summary&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function getcontents(frame,country,params)&lt;br /&gt;
  return frame:expandTemplate({title=&amp;quot;Country data &amp;quot;..country;args=params})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getcachedtable(frame, country, params)&lt;br /&gt;
	country = mostUsed.redirects[country] or country&lt;br /&gt;
	if params and next(params) then return p.gettable(frame, country, params) end&lt;br /&gt;
	-- Uses mw.loadData to cache data for the most-used templates&lt;br /&gt;
	if mostUsed.pages[country] then&lt;br /&gt;
		local cache = mw.loadData(&amp;#039;Module:CountryData/cache&amp;#039; .. mostUsed.pages[country])&lt;br /&gt;
		if cache.data[country] then return cache.data[country] end&lt;br /&gt;
	end&lt;br /&gt;
	-- if not in cache&lt;br /&gt;
	return p.gettable(frame, country, params)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.gettable(frame,country,params)&lt;br /&gt;
--Returns the parameters of a country data template as a Lua table&lt;br /&gt;
  --If not a valid data template, return empty table&lt;br /&gt;
  local bool, s = pcall(getcontents,frame,country,params or {})&lt;br /&gt;
  if bool and (string.find(s,&amp;quot;^%{%{ *%{%{%{1&amp;quot;) or string.find(s,&amp;quot;^%{%{safesubst: *%{%{%{1&amp;quot;))&lt;br /&gt;
  then&lt;br /&gt;
    --Replace parameter delimiters with arbitrary control characters&lt;br /&gt;
    --to avoid clashes if param values contain equals/pipe signs&lt;br /&gt;
    s = string.gsub(s,&amp;quot;|([^|=]-)=&amp;quot;,&amp;quot;\1\1%1\2&amp;quot;)&lt;br /&gt;
    s = string.gsub(s,&amp;quot;}}%s*$&amp;quot;,&amp;quot;\1&amp;quot;)&lt;br /&gt;
    --Loop over string and add params to table&lt;br /&gt;
    local part = {}&lt;br /&gt;
    for par in string.gmatch(s,&amp;quot;\1[^\1\2]-\2[^\1\2]-\1&amp;quot;) do&lt;br /&gt;
      local k = string.match(par,&amp;quot;\1%s*(.-)%s*\2&amp;quot;)&lt;br /&gt;
      local v = string.match(par,&amp;quot;\2%s*(.-)%s*\1&amp;quot;)&lt;br /&gt;
      if v and not (v==&amp;quot;&amp;quot; and string.find(k,&amp;quot;^flag alias&amp;quot;)) then&lt;br /&gt;
        part[k] = v&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    return part&lt;br /&gt;
  else&lt;br /&gt;
  	return {}&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getalias(frame)&lt;br /&gt;
--Returns a single parameter value from a data template&lt;br /&gt;
  local part = p.gettable(frame,frame.args[1])&lt;br /&gt;
  if frame.args.variant&lt;br /&gt;
    then return tostring(part[frame.args[2]..&amp;quot;-&amp;quot;..frame.args.variant]&lt;br /&gt;
                         or part[frame.args[2]] or frame.args.def)&lt;br /&gt;
    else return tostring(part[frame.args[2]] or frame.args.def)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.gettemplate(frame)&lt;br /&gt;
--For testing, recreates the country data from the created Lua table&lt;br /&gt;
  --Get data table&lt;br /&gt;
  local data = p.gettable(frame,frame.args[1])&lt;br /&gt;
  --Concatenate fields into a template-like string&lt;br /&gt;
  local out = &amp;quot;{{ {{{1}}}&amp;quot;&lt;br /&gt;
  for k,v in pairs(data) do&lt;br /&gt;
    out = out..&amp;quot;\n| &amp;quot;..k..&amp;quot; = &amp;quot;..v&lt;br /&gt;
  end&lt;br /&gt;
  return out..&amp;quot;\n}}&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;GKFX</name></author>
	</entry>
</feed>