<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AHistorical_populations</id>
	<title>Module:Historical populations - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AHistorical_populations"/>
	<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Historical_populations&amp;action=history"/>
	<updated>2026-04-05T22:23:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.5</generator>
	<entry>
		<id>https://www.cultopedia.org/index.php?title=Module:Historical_populations&amp;diff=1132&amp;oldid=prev</id>
		<title>imported&gt;Krinkle: Fix cache bug causing articles like Tumbler Ridge to have 30min cache instead of 30 days, ref phab:T416616. os.time() changes every second.</title>
		<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Historical_populations&amp;diff=1132&amp;oldid=prev"/>
		<updated>2026-02-18T10:22:35Z</updated>

		<summary type="html">&lt;p&gt;Fix cache bug causing articles like &lt;a href=&quot;https://en.wikipedia.org/wiki/Tumbler_Ridge&quot; class=&quot;extiw cultopedia-missing-wikipedia&quot; title=&quot;Tumbler Ridge on Wikipedia&quot; rel=&quot;nofollow&quot;&gt;Tumbler Ridge&lt;/a&gt; to have 30min cache instead of 30 days, ref &lt;a href=&quot;https://en.wikipedia.org/wiki/Phab%3AT416616&quot; class=&quot;extiw cultopedia-missing-wikipedia&quot; title=&quot;Phab:T416616 on Wikipedia&quot; rel=&quot;nofollow&quot;&gt;phab:T416616&lt;/a&gt;. os.time() changes every second.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This template implements {{Historical populations}}&lt;br /&gt;
--&lt;br /&gt;
local p = {}&lt;br /&gt;
local lang = mw.getContentLanguage()&lt;br /&gt;
local Date -- lazy initialization&lt;br /&gt;
&lt;br /&gt;
local function ifexist(page)&lt;br /&gt;
    if not page then return false end&lt;br /&gt;
    if mw.title.new(page).exists then return true end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isempty( s )&lt;br /&gt;
	return not s or s:match( &amp;#039;^%s*(.-)%s*$&amp;#039; ) == &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function splitnumandref( s )&lt;br /&gt;
	s = s:match( &amp;#039;^%s*(.-)%s*$&amp;#039; )&lt;br /&gt;
	local t1 = mw.text.unstrip(s)&lt;br /&gt;
        local t2 = s:match( &amp;#039;^([%d][%d,]*)&amp;#039; )&lt;br /&gt;
	if( t1 == t2 ) then&lt;br /&gt;
		local t3 = s:match( &amp;#039;^[%d][%d,]*(.-)$&amp;#039; )&lt;br /&gt;
		return t1, t3&lt;br /&gt;
	else&lt;br /&gt;
		return s, &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatnumR(num)&lt;br /&gt;
	return tonumber(lang:parseFormattedNumber(num))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatnum(num)&lt;br /&gt;
	return lang:parseFormattedNumber(num) and lang:formatNum(lang:parseFormattedNumber(num)) or num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this function creates an array with the {year, population, percent change}&lt;br /&gt;
local function getpoprow(year, popstr, pyear, ppopstr, linktype, percentages, current_year)&lt;br /&gt;
	local pop, popref = splitnumandref( popstr or &amp;#039;&amp;#039;)&lt;br /&gt;
	local ppop, ppopref = splitnumandref( ppopstr or &amp;#039;&amp;#039;)&lt;br /&gt;
	local percent = &amp;#039;&amp;#039;&lt;br /&gt;
	local yearnum = formatnumR(mw.ustring.gsub(year or &amp;#039;&amp;#039;, &amp;#039;^%s*([%d][%d][%.%d]+).*$&amp;#039;, &amp;#039;%1&amp;#039;) or &amp;#039;&amp;#039;)&lt;br /&gt;
	local pyearnum = formatnumR(mw.ustring.gsub(pyear or &amp;#039;&amp;#039;, &amp;#039;^%s*([%d][%d][%.%d]+).*$&amp;#039;, &amp;#039;%1&amp;#039;) or &amp;#039;&amp;#039;)&lt;br /&gt;
	local popnum = formatnumR(pop)&lt;br /&gt;
	local ppopnum = formatnumR(ppop)&lt;br /&gt;
	if( linktype == &amp;#039;US&amp;#039; or linktype == &amp;#039;USA&amp;#039; ) then&lt;br /&gt;
		if( (yearnum or 0) &amp;gt;= 1790 and yearnum &amp;lt;= current_year and math.fmod(math.floor(yearnum), 10) == 0) then&lt;br /&gt;
			if( yearnum &amp;lt; current_year ) then&lt;br /&gt;
				year = &amp;#039;[[&amp;#039; .. tostring(yearnum) .. &amp;#039; United States census|&amp;#039; .. year .. &amp;#039;]]&amp;#039;&lt;br /&gt;
  			elseif( ifexist(tostring(yearnum) .. &amp;#039; United States census&amp;#039;) ) then&lt;br /&gt;
				year = &amp;#039;[[&amp;#039; .. tostring(yearnum) .. &amp;#039; United States census|&amp;#039; .. year .. &amp;#039;]]&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if(percentages ~= &amp;#039;off&amp;#039;) then&lt;br /&gt;
		local pstr = &amp;#039;—&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
		if(popnum ~= nil and ppopnum ~= nil and (ppopnum &amp;gt; 0)) then&lt;br /&gt;
			if(percentages == &amp;#039;pagr&amp;#039;) then&lt;br /&gt;
				pstr = mw.ustring.format(&amp;#039;%.2f&amp;#039;, 100*math.abs(math.pow(popnum/ppopnum,1/(yearnum-pyearnum)) - 1))&lt;br /&gt;
			elseif(percentages == &amp;#039;monthly&amp;#039;) then&lt;br /&gt;
				if Date == nil then Date = require(&amp;#039;Module:Date&amp;#039;)._Date end&lt;br /&gt;
				local date1 = Date(year)&lt;br /&gt;
				local date2 = Date(pyear)&lt;br /&gt;
				local diff = date1 - date2&lt;br /&gt;
				local months = (diff.age_days/(365.25/12))&lt;br /&gt;
				pstr = mw.ustring.format(&amp;#039;%.2f&amp;#039;, 100*math.abs(math.pow(popnum/ppopnum,1/months) - 1))&lt;br /&gt;
			else&lt;br /&gt;
				pstr = mw.ustring.format(&amp;#039;%.1f&amp;#039;, 100*math.abs(popnum/ppopnum - 1))&lt;br /&gt;
			end&lt;br /&gt;
			if( popnum &amp;lt; ppopnum ) then&lt;br /&gt;
				pstr = &amp;#039;−&amp;#039; .. pstr .. &amp;#039;%&amp;#039;&lt;br /&gt;
			else&lt;br /&gt;
				pstr = &amp;#039;+&amp;#039; .. pstr .. &amp;#039;%&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		elseif(popnum ~= nil and ppopnum ~= nil and (ppopnum == popnum)) then&lt;br /&gt;
			pstr = mw.ustring.format(&amp;#039;%.2f&amp;#039;, 0) .. &amp;#039;%&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		percent = pstr&lt;br /&gt;
	end&lt;br /&gt;
	-- strip the fractional part of the year, if there is one&lt;br /&gt;
	year = mw.ustring.gsub(year or &amp;#039;&amp;#039;, &amp;#039;^%s*([%d][%d][%d]+)%.[%d]*&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	return {year, formatnum(pop) .. popref, percent }&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this function creates an array with table header labels&lt;br /&gt;
local function getheadrow(percentages, popname, yearname, percentname)&lt;br /&gt;
	-- year cell	&lt;br /&gt;
	if(yearname == &amp;#039;&amp;#039;) then&lt;br /&gt;
		yearname = &amp;#039;Year&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- population cell&lt;br /&gt;
	if(popname == &amp;#039;&amp;#039;) then&lt;br /&gt;
		popname = &amp;#039;&amp;lt;abbr title=&amp;quot;Population&amp;quot; class=&amp;quot;abbr-header&amp;quot;&amp;gt;Pop.&amp;lt;/abbr&amp;gt;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- percentages cell&lt;br /&gt;
	if( percentages ~= &amp;#039;off&amp;#039; and percentname == &amp;#039;&amp;#039;) then&lt;br /&gt;
		if( percentages == &amp;#039;pagr&amp;#039; ) then&lt;br /&gt;
			percentname = &amp;#039;&amp;lt;abbr title=&amp;quot;Per annum growth rate&amp;quot; class=&amp;quot;abbr-header&amp;quot;&amp;gt;±% p.a.&amp;lt;/abbr&amp;gt;&amp;#039;&lt;br /&gt;
		elseif( percentages == &amp;#039;monthly&amp;#039; ) then&lt;br /&gt;
			percentname = &amp;#039;&amp;lt;abbr title=&amp;quot;Per month growth rate&amp;quot; class=&amp;quot;abbr-header&amp;quot;&amp;gt;±% p.m.&amp;lt;/abbr&amp;gt;&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			percentname = &amp;#039;&amp;lt;abbr title=&amp;quot;Percent change&amp;quot; class=&amp;quot;abbr-header&amp;quot;&amp;gt;±%&amp;lt;/abbr&amp;gt;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return {yearname, popname, percentname}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this function builds the json for the population graph&lt;br /&gt;
local function graphjson(data, gwidth, gheight, gtype)&lt;br /&gt;
	local yearcount = #data&lt;br /&gt;
	local graphargs = {&lt;br /&gt;
		[&amp;#039;width&amp;#039;] = gwidth,&lt;br /&gt;
		[&amp;#039;height&amp;#039;] = gheight,&lt;br /&gt;
		[&amp;#039;type&amp;#039;] = gtype or &amp;#039;line&amp;#039;,&lt;br /&gt;
		[&amp;#039;yAxisTitle&amp;#039;] = &amp;#039;Population&amp;#039;,&lt;br /&gt;
		[&amp;#039;yAxisMin&amp;#039;] = 0,&lt;br /&gt;
		[&amp;#039;xAxisTitle&amp;#039;] = &amp;#039;Year&amp;#039;,&lt;br /&gt;
		[&amp;#039;xAxisAngle&amp;#039;] = &amp;#039;-45&amp;#039;,&lt;br /&gt;
		[&amp;#039;yGrid&amp;#039;] = &amp;#039;y&amp;#039;,&lt;br /&gt;
		[&amp;#039;yAxisFormat&amp;#039;] = &amp;#039;,d&amp;#039;,&lt;br /&gt;
		[&amp;#039;x&amp;#039;] = &amp;#039;&amp;#039;,&lt;br /&gt;
		[&amp;#039;y&amp;#039;] = &amp;#039;&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	local firstpoint = true&lt;br /&gt;
	for offset = 1,yearcount do&lt;br /&gt;
		local x,y = data[offset][1], data[offset][2]&lt;br /&gt;
		-- delink if necessary&lt;br /&gt;
		if x:match(&amp;#039;^%s*%[%[[^%[%]]*%|([^%[%]]*)%]%]&amp;#039;) then&lt;br /&gt;
			x = x:match(&amp;#039;^%s*%[%[[^%[%]]*%|([^%[%]]*)%]%]&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		y = formatnumR(y)&lt;br /&gt;
		if x and y then&lt;br /&gt;
			graphargs[&amp;#039;x&amp;#039;] = graphargs[&amp;#039;x&amp;#039;] .. (firstpoint and &amp;#039;&amp;#039; or &amp;#039;, &amp;#039;) .. x&lt;br /&gt;
			graphargs[&amp;#039;y&amp;#039;] = graphargs[&amp;#039;y&amp;#039;] .. (firstpoint and &amp;#039;&amp;#039; or &amp;#039;, &amp;#039;) .. y&lt;br /&gt;
			firstpoint = false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local Graph = require(&amp;#039;Module:Graph&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	return Graph.chart({args = graphargs})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function rendergraph(frame, data, gwidth, gheight, gthumb, gtype) -- This code has been disabled because the graph extension is permanently disabled&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
	--[[local graph = frame:extensionTag{name = &amp;#039;graph&amp;#039;, content = graphjson(data, gwidth, gheight, gtype)}&lt;br /&gt;
&lt;br /&gt;
	if(gthumb ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		local graphdiv = mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;thumb&amp;#039;)&lt;br /&gt;
			:addClass(gthumb == &amp;#039;right&amp;#039; and &amp;#039;tright&amp;#039; or &amp;#039;tleft&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;clear&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
		graphdiv&lt;br /&gt;
			:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;thumbinner&amp;#039;)&lt;br /&gt;
			:wikitext(graph)&lt;br /&gt;
		return tostring(graphdiv)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;#039;&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&amp;#039; .. graph .. &amp;#039;&amp;lt;/div&amp;gt;&amp;#039;]]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this function renders the population table in a vertical format&lt;br /&gt;
local function rendervertical(data, head, title, footnote, alignfn, class, style, width, shading, percol, cols, graphpos, graph)&lt;br /&gt;
	-- define a couple helper functions&lt;br /&gt;
	local function addrowcell(trow, tag, text, align, shading, style)&lt;br /&gt;
		cell = trow:tag(tag)&lt;br /&gt;
		cell&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, align)&lt;br /&gt;
			:css(&amp;#039;padding&amp;#039;, &amp;#039;1px&amp;#039;)&lt;br /&gt;
			:wikitext(text)&lt;br /&gt;
			:css(&amp;#039;border-bottom&amp;#039;, shading ~= &amp;#039;off&amp;#039; and &amp;#039;1px solid #bbbbbb&amp;#039; or nil)&lt;br /&gt;
			:cssText(style)&lt;br /&gt;
	end&lt;br /&gt;
	local function addheadcell(trow, text, align, width, pad)&lt;br /&gt;
		cell = trow:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:css(&amp;#039;border-bottom&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;padding&amp;#039;, pad and (&amp;#039;1px &amp;#039; .. pad) or &amp;#039;1px&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, align)&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, width)&lt;br /&gt;
			:wikitext(text)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local colspan = 3&lt;br /&gt;
	local yearcount = #data&lt;br /&gt;
	local argcount = 2*yearcount&lt;br /&gt;
	&lt;br /&gt;
	if( isempty(width) ) then&lt;br /&gt;
		width = &amp;#039;15em&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- override the value of cols if percol has been specified&lt;br /&gt;
	if( percol &amp;gt; 0 ) then&lt;br /&gt;
		cols = math.floor( (yearcount - 1) / percol ) + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- compute the number of rows per col&lt;br /&gt;
	local rowspercol = math.floor( (yearcount - 1) / cols ) + 1&lt;br /&gt;
&lt;br /&gt;
	-- specify the colspan for the title and footer lines&lt;br /&gt;
	if( cols &amp;gt; 1 ) then&lt;br /&gt;
		colspan = cols&lt;br /&gt;
	else&lt;br /&gt;
		if (head[3] == &amp;#039;&amp;#039;) then &lt;br /&gt;
			colspan = 2&lt;br /&gt;
		else&lt;br /&gt;
			colspan = 3&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- compute outer table width&lt;br /&gt;
	local twidth = width&lt;br /&gt;
	if( (cols &amp;gt; 1) and width:match(&amp;#039;^%s*[%d]+[%w]+%s*$&amp;#039;) ) then&lt;br /&gt;
		local widthnum = mw.ustring.gsub( width, &amp;#039;^%s*([%d]+)([%w]+)%s*$&amp;#039;, &amp;#039;%1&amp;#039; )&lt;br /&gt;
		local widthunit = mw.ustring.gsub( width, &amp;#039;^%s*([%d]+)([%w]+)%s*$&amp;#039;, &amp;#039;%2&amp;#039; )&lt;br /&gt;
		twidth = tostring(widthnum*cols) .. widthunit&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- create the outer table&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	root&lt;br /&gt;
		:addClass(class)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, twidth)&lt;br /&gt;
		:css(&amp;#039;border-top-width&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		:cssText(style[&amp;#039;table&amp;#039;])&lt;br /&gt;
	-- add title&lt;br /&gt;
	if( cols &amp;lt;= 1) then&lt;br /&gt;
	local caption = root:tag(&amp;#039;caption&amp;#039;)&lt;br /&gt;
	caption&lt;br /&gt;
		:css(&amp;#039;padding&amp;#039;, &amp;#039;0.25em&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bold&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;class&amp;#039;, &amp;#039;caption-purple&amp;#039;)&lt;br /&gt;
		:wikitext(title)&lt;br /&gt;
	end&lt;br /&gt;
	if( cols &amp;gt; 1) then&lt;br /&gt;
	local caption = root:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
	caption&lt;br /&gt;
		:css(&amp;#039;padding&amp;#039;, &amp;#039;0.25em&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bold&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;colspan&amp;#039;, cols)&lt;br /&gt;
	divcaption = caption:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
	divcaption&lt;br /&gt;
		:css(&amp;#039;margin&amp;#039;, &amp;#039;-0.65em -0.565em 0 -0.565em&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;border-left&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;border-right&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;padding&amp;#039;, &amp;#039;0.3em 0&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;class&amp;#039;, &amp;#039;caption-purple&amp;#039;)&lt;br /&gt;
		:wikitext(title)&lt;br /&gt;
	root:attr(&amp;#039;role&amp;#039;, &amp;#039;presentation&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	-- add the graph line (if top graph)&lt;br /&gt;
	if((graphpos == &amp;#039;top&amp;#039; or graphpos == &amp;#039;t&amp;#039;) and graph ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colspan)&lt;br /&gt;
			:css(&amp;#039;border-bottom&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:wikitext(graph)&lt;br /&gt;
		graph = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- loop over columns and rows within columns&lt;br /&gt;
	local offset = 1&lt;br /&gt;
	local t = root&lt;br /&gt;
	for c = 1,cols do&lt;br /&gt;
		-- add inner tables if we are rendering more than one column&lt;br /&gt;
		if( cols &amp;gt; 1) then&lt;br /&gt;
			if (c == 1) then&lt;br /&gt;
				row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
				row:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;top&amp;#039;)&lt;br /&gt;
				cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				cell&lt;br /&gt;
					:css(&amp;#039;padding&amp;#039;, &amp;#039;0 0.5em&amp;#039;)&lt;br /&gt;
			else&lt;br /&gt;
				cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				cell&lt;br /&gt;
					:css(&amp;#039;padding&amp;#039;, &amp;#039;0 0.5em&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;border-left&amp;#039;, &amp;#039;solid 1px #aaa&amp;#039;)&lt;br /&gt;
			end&lt;br /&gt;
			t = cell:tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
			t&lt;br /&gt;
				:css(&amp;#039;border-spacing&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, width)&lt;br /&gt;
		end&lt;br /&gt;
		-- start column headers&lt;br /&gt;
		local hrow = t:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		hrow:css(&amp;#039;font-size&amp;#039;, &amp;#039;95%&amp;#039;)&lt;br /&gt;
		-- year header&lt;br /&gt;
		addheadcell(hrow, head[1], nil, head[3] ~= &amp;#039;&amp;#039; and &amp;#039;3em&amp;#039; or &amp;#039;auto&amp;#039;, nil, nil)&lt;br /&gt;
		-- population header&lt;br /&gt;
		addheadcell(hrow, head[2], &amp;#039;right&amp;#039;, nil, &amp;#039;2px&amp;#039;)&lt;br /&gt;
		-- percentages header&lt;br /&gt;
		if( head[3] ~= &amp;#039;&amp;#039; ) then&lt;br /&gt;
			addheadcell(hrow, head[3], &amp;#039;right&amp;#039;, nil, nil)&lt;br /&gt;
		end&lt;br /&gt;
		-- end column headers&lt;br /&gt;
		-- start population rows&lt;br /&gt;
		for r = 1,rowspercol do&lt;br /&gt;
			-- generate the row if we have not exceeded the rowcount&lt;br /&gt;
			-- shade every fifth row, unless shading = off&lt;br /&gt;
			local s = &amp;#039;off&amp;#039;&lt;br /&gt;
			if( math.fmod((c - 1)*rowspercol + r, 5) == 0 and r ~= rowspercol) then&lt;br /&gt;
				s = shading&lt;br /&gt;
			end&lt;br /&gt;
			if(offset &amp;lt;= yearcount) then&lt;br /&gt;
				-- start population row&lt;br /&gt;
				local prow = t:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
				-- year cell&lt;br /&gt;
				addrowcell(prow, &amp;#039;th&amp;#039;, data[offset][1], &amp;#039;center&amp;#039;, s, style[&amp;#039;year&amp;#039;])&lt;br /&gt;
				-- population cell&lt;br /&gt;
				addrowcell(prow, &amp;#039;td&amp;#039;, data[offset][2], &amp;#039;right&amp;#039;, s, style[&amp;#039;pop&amp;#039;])&lt;br /&gt;
				-- percentage cell&lt;br /&gt;
				if( not isempty(head[3]) ) then&lt;br /&gt;
					addrowcell(prow, &amp;#039;td&amp;#039;, data[offset][3], &amp;#039;right&amp;#039;, s, style[&amp;#039;pct&amp;#039;])&lt;br /&gt;
				end&lt;br /&gt;
				-- end population row&lt;br /&gt;
				offset = offset + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add the graph line (if bottom graph)&lt;br /&gt;
	if((graphpos == &amp;#039;bottom&amp;#039; or graphpos == &amp;#039;b&amp;#039;) and graph ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colspan)&lt;br /&gt;
			:css(&amp;#039;border-top&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:wikitext(graph)&lt;br /&gt;
		graph = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- add the footnote line 	&lt;br /&gt;
	if( footnote ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colspan)&lt;br /&gt;
			:css(&amp;#039;border-top&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;85%&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, alignfn)&lt;br /&gt;
			:wikitext(footnote)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return graph .. tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this function renders the population table in a horizontal format&lt;br /&gt;
local function renderhorizontal(data, head, title, footnote, alignfn, class, style, width, shading, perrow, rows, graphpos, graph)&lt;br /&gt;
	local row&lt;br /&gt;
	local cell&lt;br /&gt;
	local yearcount = #data&lt;br /&gt;
	local argcount = 2*yearcount&lt;br /&gt;
	&lt;br /&gt;
	-- override the value of rows if perrow has been specified&lt;br /&gt;
	if( perrow &amp;gt; 0 ) then&lt;br /&gt;
		rows = math.floor( (yearcount - 1) / perrow ) + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- compute the number of cols per row&lt;br /&gt;
	local colsperrow = math.floor( (yearcount - 1) / rows ) + 1&lt;br /&gt;
&lt;br /&gt;
	-- create the outer table&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	root&lt;br /&gt;
		:addClass(class)&lt;br /&gt;
		:css(&amp;#039;font-size&amp;#039;, &amp;#039;90%&amp;#039;)&lt;br /&gt;
		:cssText(style[&amp;#039;table&amp;#039;])&lt;br /&gt;
	-- create title row&lt;br /&gt;
	row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	cell = row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
	cell&lt;br /&gt;
		:css(&amp;#039;padding&amp;#039;, &amp;#039;0.25em&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;colspan&amp;#039;, colsperrow + 1)&lt;br /&gt;
		:wikitext(title)&lt;br /&gt;
&lt;br /&gt;
	-- add the graph line (if top graph)&lt;br /&gt;
	if((graphpos == &amp;#039;top&amp;#039; or graphpos == &amp;#039;t&amp;#039;) and graph ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colsperrow + 1)&lt;br /&gt;
			:css(&amp;#039;border-bottom&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:wikitext(graph)&lt;br /&gt;
		graph = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- loop over rows and columns within rows&lt;br /&gt;
	local offset = 1&lt;br /&gt;
	for r = 1,rows do&lt;br /&gt;
		local rowoffset = offset&lt;br /&gt;
		-- render the years&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		cell:wikitext(head[1])&lt;br /&gt;
			:css(&amp;#039;border-top&amp;#039;, r &amp;gt; 1 and &amp;#039;2px solid #000&amp;#039; or nil)&lt;br /&gt;
		for c = 1,colsperrow do&lt;br /&gt;
			cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			if(offset &amp;lt;= yearcount) then&lt;br /&gt;
				cell:wikitext(data[offset][1])&lt;br /&gt;
					:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;border-top&amp;#039;, r &amp;gt; 1 and &amp;#039;2px solid #000&amp;#039; or nil)&lt;br /&gt;
					:cssText(style[&amp;#039;year&amp;#039;])&lt;br /&gt;
			else&lt;br /&gt;
				cell:css(&amp;#039;border-width&amp;#039;, r &amp;gt; 1 and &amp;#039;2px 0 0 0&amp;#039; or 0)&lt;br /&gt;
					:css(&amp;#039;border-top&amp;#039;, r &amp;gt; 1 and &amp;#039;2px solid #000&amp;#039; or nil)&lt;br /&gt;
			end&lt;br /&gt;
			offset = offset + 1&lt;br /&gt;
		end&lt;br /&gt;
		-- render the pop&lt;br /&gt;
		offset = rowoffset&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		cell:wikitext(head[2])&lt;br /&gt;
		for c = 1,colsperrow do&lt;br /&gt;
			cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			if(offset &amp;lt;= yearcount) then&lt;br /&gt;
				cell:wikitext(data[offset][2])&lt;br /&gt;
					:css(&amp;#039;text-align&amp;#039;, &amp;#039;right&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;padding-right&amp;#039;, &amp;#039;2px&amp;#039;)&lt;br /&gt;
					:cssText(style[&amp;#039;pop&amp;#039;])&lt;br /&gt;
			else&lt;br /&gt;
				cell:css(&amp;#039;border-width&amp;#039;, 0)&lt;br /&gt;
			end&lt;br /&gt;
			offset = offset + 1&lt;br /&gt;
		end&lt;br /&gt;
		-- render the percentages&lt;br /&gt;
		if(head[3] ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
			offset = rowoffset&lt;br /&gt;
			row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			cell = row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			cell:wikitext(head[3])&lt;br /&gt;
			for c = 1,colsperrow do&lt;br /&gt;
				cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				if(offset &amp;lt;= yearcount) then&lt;br /&gt;
					cell:wikitext(data[offset][3])&lt;br /&gt;
						:css(&amp;#039;text-align&amp;#039;, &amp;#039;right&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;padding-right&amp;#039;, &amp;#039;2px&amp;#039;)&lt;br /&gt;
						:cssText(style[&amp;#039;pct&amp;#039;])&lt;br /&gt;
				else&lt;br /&gt;
					cell:css(&amp;#039;border-width&amp;#039;, 0)&lt;br /&gt;
				end&lt;br /&gt;
				offset = offset + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- add the graph line (if bottom graph)&lt;br /&gt;
	if((graphpos == &amp;#039;bottom&amp;#039; or graphpos == &amp;#039;b&amp;#039;) and graph ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colsperrow + 1)&lt;br /&gt;
			:css(&amp;#039;border-top&amp;#039;, &amp;#039;1px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:wikitext(graph)&lt;br /&gt;
		graph = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- add the footnote line 	&lt;br /&gt;
	if( footnote ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:css(&amp;#039;border-top&amp;#039;, &amp;#039;2px solid var(--color-base, #000000)&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;85%&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, alignfn)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, colsperrow + 1)&lt;br /&gt;
			:wikitext(footnote)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return graph .. tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this is the main function&lt;br /&gt;
function p.poptable(frame)&lt;br /&gt;
	local data = {}&lt;br /&gt;
	local style = {}&lt;br /&gt;
	local args = frame.args[1] and frame.args or frame:getParent().args&lt;br /&gt;
&lt;br /&gt;
	local title			= args[&amp;#039;title&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local align			= args[&amp;#039;align&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local clear			= args[&amp;#039;clear&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local direction		= args[&amp;#039;direction&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local percentages	= args[&amp;#039;percentages&amp;#039;]	or &amp;#039;&amp;#039;&lt;br /&gt;
	local state			= args[&amp;#039;state&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local linktype		= args[&amp;#039;type&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local shading		= args[&amp;#039;shading&amp;#039;]		or &amp;#039;on&amp;#039;&lt;br /&gt;
	local width			= args[&amp;#039;width&amp;#039;]			or &amp;#039;&amp;#039;&lt;br /&gt;
	local subbox		= args[&amp;#039;subbox&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local popname		= args[&amp;#039;pop_name&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local yearname		= args[&amp;#039;year_name&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local percentname   = args[&amp;#039;percent_name&amp;#039;]  or &amp;#039;&amp;#039;&lt;br /&gt;
	local footnote		= args[&amp;#039;footnote&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local alignfn		= args[&amp;#039;align-fn&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local source		= args[&amp;#039;source&amp;#039;]		or &amp;#039;&amp;#039;&lt;br /&gt;
	local graphpos      = args[&amp;#039;graph-pos&amp;#039;]     or &amp;#039;&amp;#039;&lt;br /&gt;
	local graphwidth    = args[&amp;#039;graph-width&amp;#039;]   or &amp;#039;&amp;#039;&lt;br /&gt;
	local graphheight   = args[&amp;#039;graph-height&amp;#039;]  or &amp;#039;&amp;#039;&lt;br /&gt;
	local graphtype     = args[&amp;#039;graph-type&amp;#039;]    or &amp;#039;line&amp;#039;&lt;br /&gt;
	local percol = tonumber(args[&amp;#039;percol&amp;#039;])	or 0&lt;br /&gt;
	local cols	 = tonumber(args[&amp;#039;cols&amp;#039;])	or 1&lt;br /&gt;
	local perrow = tonumber(args[&amp;#039;perrow&amp;#039;])	or 0&lt;br /&gt;
	local rows	 = tonumber(args[&amp;#039;rows&amp;#039;])	or 1&lt;br /&gt;
	style[&amp;#039;year&amp;#039;] = args[&amp;#039;year_style&amp;#039;]&lt;br /&gt;
	style[&amp;#039;pop&amp;#039;]  = args[&amp;#039;pop_style&amp;#039;]&lt;br /&gt;
	style[&amp;#039;pct&amp;#039;]  = args[&amp;#039;pct_style&amp;#039;]&lt;br /&gt;
&lt;br /&gt;
	-- setup classes and styling for outer table&lt;br /&gt;
	local class = direction == &amp;#039;horizontal&amp;#039; and &amp;#039;wikitable&amp;#039; or &amp;#039;table-pale&amp;#039;&lt;br /&gt;
	if( state == &amp;#039;collapsed&amp;#039; ) then&lt;br /&gt;
		class = class .. &amp;#039; collapsible collapsed&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if( isempty(title) ) then&lt;br /&gt;
		title = &amp;#039;Historical population&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if( isempty(align) ) then&lt;br /&gt;
		align = direction ~= &amp;#039;horizontal&amp;#039; and &amp;#039;right&amp;#039; or &amp;#039;center&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if( isempty(alignfn) ) then&lt;br /&gt;
		alignfn = &amp;#039;left&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if( isempty(clear) ) then&lt;br /&gt;
		clear = align == &amp;#039;center&amp;#039; and &amp;#039;&amp;#039; or align&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local margin = &amp;#039;0.5em 0 1em 0.5em&amp;#039;&lt;br /&gt;
	if( align == &amp;#039;left&amp;#039; ) then&lt;br /&gt;
		margin = &amp;#039;0.5em 1em 0.5em 0&amp;#039;&lt;br /&gt;
	elseif( align == &amp;#039;none&amp;#039; ) then&lt;br /&gt;
		margin = &amp;#039;0.5em 1em 0.5em 0&amp;#039;&lt;br /&gt;
	elseif( align == &amp;#039;center&amp;#039; ) then&lt;br /&gt;
		margin = &amp;#039;0.5em auto&amp;#039;&lt;br /&gt;
		align = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if( isempty(subbox) ) then&lt;br /&gt;
		style[&amp;#039;table&amp;#039;] =&lt;br /&gt;
			&amp;#039;border-spacing: 0;&amp;#039; ..&lt;br /&gt;
			(align ~= &amp;#039;&amp;#039; and &amp;#039;float:&amp;#039; .. align .. &amp;#039;;&amp;#039; or &amp;#039;&amp;#039;) ..&lt;br /&gt;
			(clear ~= &amp;#039;&amp;#039; and &amp;#039;clear:&amp;#039; .. clear .. &amp;#039;;&amp;#039; or &amp;#039;&amp;#039;) ..&lt;br /&gt;
			&amp;#039;margin:&amp;#039; .. margin .. &amp;#039;;&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		style[&amp;#039;table&amp;#039;] =&lt;br /&gt;
			&amp;#039;margin:0;&amp;#039; ..&lt;br /&gt;
			&amp;#039;border-collapse:collapse;&amp;#039; ..&lt;br /&gt;
			&amp;#039;border:none;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	style[&amp;#039;table&amp;#039;] = style[&amp;#039;table&amp;#039;] .. (args[&amp;#039;table_style&amp;#039;] or &amp;#039;&amp;#039;)&lt;br /&gt;
		&lt;br /&gt;
	-- setup the footer text&lt;br /&gt;
	if( source ~= &amp;#039;&amp;#039; ) then&lt;br /&gt;
		source = &amp;#039;Source: &amp;#039; .. source&lt;br /&gt;
		if( footnote ~= &amp;#039;&amp;#039; ) then&lt;br /&gt;
			footnote = footnote .. &amp;#039;&amp;lt;br/&amp;gt;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	footnote = footnote .. source&lt;br /&gt;
	&lt;br /&gt;
	-- setup the data header cols/rows&lt;br /&gt;
	local head = getheadrow(percentages, popname, yearname, percentname)&lt;br /&gt;
	&lt;br /&gt;
	-- count the total number of population rows&lt;br /&gt;
	local argcount = 0&lt;br /&gt;
	local rowcount = 0&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if ( (type( k ) == &amp;#039;number&amp;#039;) and (not isempty(args[k])) ) then&lt;br /&gt;
			if( k &amp;gt;= 1 and math.floor(k) == k and k &amp;gt; argcount) then&lt;br /&gt;
				argcount = k&lt;br /&gt;
			end&lt;br /&gt;
			if( math.fmod(k - 1, 2) == 0 ) then&lt;br /&gt;
				rowcount = rowcount + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- here is where we build all the data for the table&lt;br /&gt;
	-- loop over columns and rows within columns&lt;br /&gt;
	local pyear = &amp;#039;&amp;#039;&lt;br /&gt;
	local ppop = &amp;#039;&amp;#039;&lt;br /&gt;
	local offset = 1&lt;br /&gt;
	local current_year = tonumber(os.date(&amp;quot;%Y&amp;quot;))&lt;br /&gt;
	for r = 1,rowcount do&lt;br /&gt;
		-- skip blank rows&lt;br /&gt;
		while(isempty(args[offset]) and offset &amp;lt;= argcount) do&lt;br /&gt;
			offset = offset + 2&lt;br /&gt;
		end&lt;br /&gt;
		-- generate the row if we have not exceeded the rowcount&lt;br /&gt;
		if(offset &amp;lt;= argcount) then&lt;br /&gt;
			table.insert(data, getpoprow(args[offset], args[offset + 1] or &amp;#039;&amp;#039;, pyear, ppop, &lt;br /&gt;
				linktype, percentages, current_year) )&lt;br /&gt;
			pyear = args[offset]&lt;br /&gt;
			ppop = args[offset+1] or &amp;#039;&amp;#039;&lt;br /&gt;
			offset = offset + 2&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local graph = &amp;#039;&amp;#039;&lt;br /&gt;
	graphpos = graphpos:lower()&lt;br /&gt;
	-- now that we have the data for the table, render it in the requested format&lt;br /&gt;
&lt;br /&gt;
	if (direction == &amp;#039;horizontal&amp;#039;) then&lt;br /&gt;
		if graphpos ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			local gwidth = tonumber(graphwidth) or 200&lt;br /&gt;
			local gheight= tonumber(graphheight) or 170&lt;br /&gt;
			local gthumb = &lt;br /&gt;
				(graphpos == &amp;#039;r&amp;#039; or graphpos == &amp;#039;right&amp;#039; and &amp;#039;right&amp;#039;) or&lt;br /&gt;
				(graphpos == &amp;#039;l&amp;#039; or graphpos == &amp;#039;left&amp;#039; and &amp;#039;left&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
			graph = rendergraph(frame, data, gwidth, gheight, gthumb, graphtype)&lt;br /&gt;
		end&lt;br /&gt;
		return renderhorizontal(data, head, title, footnote, alignfn, class, style, width, shading, perrow, rows, graphpos, graph)&lt;br /&gt;
	else&lt;br /&gt;
		if graphpos ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			local gwidth = tonumber(graphwidth) or (170 * cols)&lt;br /&gt;
			local gheight= tonumber(graphheight) or 170&lt;br /&gt;
			local gthumb = &lt;br /&gt;
				(graphpos == &amp;#039;r&amp;#039; or graphpos == &amp;#039;right&amp;#039; and &amp;#039;right&amp;#039;) or&lt;br /&gt;
				(graphpos == &amp;#039;l&amp;#039; or graphpos == &amp;#039;left&amp;#039; and &amp;#039;left&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
			graph = rendergraph(frame, data, gwidth, gheight, gthumb, graphtype)&lt;br /&gt;
		end&lt;br /&gt;
		return rendervertical(data, head, title, footnote, alignfn, class, style, width, shading, percol, cols, graphpos, graph)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Krinkle</name></author>
	</entry>
</feed>