<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3APopulationFromWikidata%2Fsandbox</id>
	<title>Module:PopulationFromWikidata/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3APopulationFromWikidata%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:PopulationFromWikidata/sandbox&amp;action=history"/>
	<updated>2026-04-20T02:15:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:PopulationFromWikidata/sandbox&amp;diff=144379&amp;oldid=prev</id>
		<title>imported&gt;MaiaCWilliams: Fixed comments</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:PopulationFromWikidata/sandbox&amp;diff=144379&amp;oldid=prev"/>
		<updated>2022-07-11T09:03:11Z</updated>

		<summary type="html">&lt;p&gt;Fixed comments&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
---------------- Defining variables--------------------&lt;br /&gt;
local Pop_P = &amp;quot;P1082&amp;quot; 	-- population property&lt;br /&gt;
local Applies_P = &amp;quot;P518&amp;quot;	-- applies to part property&lt;br /&gt;
local Pointin_P = &amp;quot;P585&amp;quot; -- point in time property&lt;br /&gt;
local DetMeth_P = &amp;quot;P459&amp;quot;	-- determination method property&lt;br /&gt;
local RefURL_P = &amp;quot;P854&amp;quot;		-- reference URL&lt;br /&gt;
local RefTitle_P = &amp;quot;P1476&amp;quot;	-- reference title&lt;br /&gt;
local RefPubIn_P = &amp;quot;P1433&amp;quot;	--reference published in property	&lt;br /&gt;
local DatePub_P = &amp;quot;P577&amp;quot;	-- date of publication property&lt;br /&gt;
local Publisher_P = &amp;quot;P123&amp;quot;	-- publisher property&lt;br /&gt;
local Retrieved_P = &amp;quot;P813&amp;quot;	-- retrieved property&lt;br /&gt;
local CensusAU_I = &amp;quot;Q5058971&amp;quot;	-- Australian census item&lt;br /&gt;
local Instof_P = &amp;quot;P31&amp;quot;			-- instance of property&lt;br /&gt;
local ShortN_P = &amp;quot;P1813&amp;quot;		-- short name property&lt;br /&gt;
&lt;br /&gt;
local SAL_I = &amp;quot;Q33112019&amp;quot; 	-- state suburb item (includes SSC and SAL)&lt;br /&gt;
--local GCCSA_I = &amp;quot;Q112762887&amp;quot;			-- Greater Capital City Statistical Area item&lt;br /&gt;
local LGA_I = &amp;quot;Q33127844&amp;quot;			-- Local Government Area item&lt;br /&gt;
local UCL_I = &amp;quot;Q33127891&amp;quot;		-- Urban Centre or Locality&lt;br /&gt;
--local SA2_I = &amp;quot;Q33128776&amp;quot;		-- SA2&lt;br /&gt;
local ILOC_I = &amp;quot;Q112729549&amp;quot;		-- Indigenous Location&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local item = nil&lt;br /&gt;
&lt;br /&gt;
--------------- Function GetRefsForClaim to check, collate and format all the reference components----------------------&lt;br /&gt;
&lt;br /&gt;
function GetRefsForClaim(claim, defaulttitle)								&lt;br /&gt;
	local refs = &amp;quot;&amp;quot;&lt;br /&gt;
	for b,x in pairs(claim.references) do																	-- Loop through all references in a claim and pull out the components&lt;br /&gt;
		local refurl = &amp;quot;&amp;quot;																					-- initialise an empty URL, check if there is one then populate with the actual value (if not it stays as an empty string)&lt;br /&gt;
		if claim.references[b].snaks[RefURL_P] ~= nil then&lt;br /&gt;
			refurl = claim.references[b].snaks[RefURL_P][1].datavalue.value	&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local reftitle = defaulttitle																		-- Initialise the default title as the Wikidata item title. This is the fallback title if one isn&amp;#039;t provided in the references&lt;br /&gt;
		if claim.references[b].snaks[RefTitle_P] ~= nil then&lt;br /&gt;
			reftitle = claim.references[b].snaks[RefTitle_P][1].datavalue.value.text&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local detmet = mw.wikibase.getEntity(claim.qualifiers[DetMeth_P][1].datavalue.value.id)					-- Get the dertermination method item&lt;br /&gt;
		&lt;br /&gt;
		local pubinlabel = &amp;quot;&amp;quot;																					--Initalising an empty published in label. This is the last option for this value.&lt;br /&gt;
		if claim.references[b].snaks[RefPubIn_P] ~= nil then													--Checking if the published in part of reference exists (it should for all references)&lt;br /&gt;
			local pubin = mw.wikibase.getEntity(claim.references[b].snaks[RefPubIn_P][1].datavalue.value.id)	--If it does then grab the published item and the label of that item&lt;br /&gt;
			pubinlabel = pubin.labels.en.value&lt;br /&gt;
		end&lt;br /&gt;
								&lt;br /&gt;
		local refwork = pubinlabel																				-- This value is used for non-census references, or as a fall-back value for census references with missing parts&lt;br /&gt;
		local pubdate = &amp;quot;&amp;quot;																						-- This is the fallback option if published date is missing (no date)&lt;br /&gt;
		if claim.references[b].snaks[DatePub_P] ~= nil then														-- This is the second option for the published date (given with references - this is used for non-census references)&lt;br /&gt;
			pubdate = mw.language.getContentLanguage():formatDate(&amp;#039;j F Y&amp;#039;, claim.references[b].snaks[DatePub_P][1].datavalue.value.time)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if detmet.claims[Instof_P] ~=nil and detmet.claims[Instof_P][1].mainsnak.datavalue.value.id == CensusAU_I then		-- Checking for census references (which will have different refwork and published date sources)&lt;br /&gt;
			refwork = detmet.labels.en.value..&amp;quot; &amp;quot;..pubinlabel																-- Concatenating to get work - determination method + published in (this overwrites the refwork value for census references)&lt;br /&gt;
			if detmet.claims[DatePub_P] ~=nil then&lt;br /&gt;
				pubdate = mw.language.getContentLanguage():formatDate(&amp;#039;j F Y&amp;#039;, detmet.claims[DatePub_P][1].mainsnak.datavalue.value.time) -- Overwrite the published date value if the determination method item has a date published (for census references)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local refpublisher = &amp;quot;&amp;quot;																								-- The publisher is empty if missing&lt;br /&gt;
		if detmet.claims[Publisher_P] ~= nil then&lt;br /&gt;
			local publisheritem = mw.wikibase.getEntity(detmet.claims[Publisher_P][1].mainsnak.datavalue.value.id)			-- Get the determination method item and the publisher item ID&lt;br /&gt;
			refpublisher = publisheritem.labels.en.value																	-- Get the label of the publisher item&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local refaccessdate = &amp;quot;&amp;quot;																							-- The retrieved date fallback is empty&lt;br /&gt;
		if claim.references[b].snaks[Retrieved_P] ~= nil then&lt;br /&gt;
			refaccessdate = mw.language.getContentLanguage():formatDate(&amp;#039;j F Y&amp;#039;, claim.references[b].snaks[Retrieved_P][1].datavalue.value.time) -- Populate the retrieved date if it&amp;#039;s there&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local appliespart = mw.wikibase.getEntity(claim.qualifiers[Applies_P][1].datavalue.value.id).labels.en.value					-- The ABS geography type for the particular claim (to use in reference name)&lt;br /&gt;
		local pointintime = mw.language.getContentLanguage():formatDate(&amp;#039;Y&amp;#039;, claim.qualifiers[Pointin_P][1].datavalue.value.time)		-- Getting the point in time as a YYYY (to use in the reference name)&lt;br /&gt;
		&lt;br /&gt;
		local citewebargs = {																								--Putting all the cite_web arguments into a list (for a single reference)&lt;br /&gt;
			url = refurl,&lt;br /&gt;
			title = reftitle..&amp;quot; (&amp;quot;..appliespart..&amp;quot;)&amp;quot; ,&lt;br /&gt;
			date = pubdate,&lt;br /&gt;
			work = refwork,&lt;br /&gt;
			author = &amp;quot;[[&amp;quot;..refpublisher..&amp;quot;]]&amp;quot;,																				-- Changed the publisher to author for now to match existing population references&lt;br /&gt;
			accessdate = refaccessdate&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		local wdeditpencil = mw.getCurrentFrame():expandTemplate{title = &amp;#039;EditAtWikidata&amp;#039;, args = {qid = item.id, pid = claim.id, nbsp = 1}}		--Call the Edit At Wikidata template (to add the edit pencil to end of references)&lt;br /&gt;
		&lt;br /&gt;
		local reference = mw.getCurrentFrame():expandTemplate{ title = &amp;#039;cite web&amp;#039;, args = citewebargs }						--expand template to feed arguments to cite_web&lt;br /&gt;
&lt;br /&gt;
		refs = refs..mw.getCurrentFrame():extensionTag{ name = &amp;#039;ref&amp;#039;, content = reference..wdeditpencil, { name = refwork..&amp;quot;_&amp;quot;..pointintime..&amp;quot;_&amp;quot;..appliespart..&amp;quot;_&amp;quot;..reftitle } }	--Add the reference from this iteration to the list of references for this particular claim&lt;br /&gt;
			 &lt;br /&gt;
	end	&lt;br /&gt;
	return refs																												-- List of references to be given to reflist&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
---------------This is a function for getting the population geography abbreviation and the Wikipedia article link for the population year  ---------------&lt;br /&gt;
function GetAbbrLabelYearLink(returnclaim)&lt;br /&gt;
	local appliespartitem = mw.wikibase.getEntity(returnclaim.qualifiers[Applies_P][1].datavalue.value.id)											-- This gets the item ID for the current claim Applied to Part value&lt;br /&gt;
	local abbrelabel = appliespartitem.labels.en.value																								-- This is the fall back value for the geography label if no abbreviation (short name) value exists in Wikidata item&lt;br /&gt;
	if appliespartitem.claims[ShortN_P] ~= nil then																									-- If a short name value exists then use thi value instead of the full item label.&lt;br /&gt;
		abbrelabel = mw.getCurrentFrame():expandTemplate{title = &amp;#039;Abbr&amp;#039;, args = {appliespartitem.claims[ShortN_P][1].mainsnak.datavalue.value.text , appliespartitem.labels.en.value }}		-- Output the abbreviated name with tooltip showing the full label&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local year = string.sub(returnclaim.qualifiers[Pointin_P][1].datavalue.value.time, 2, 5)														-- Get the population point in time as a year string&lt;br /&gt;
	local yearreturn = year																															-- If no links to Wikipedia articles describing population determination method exist then just output year&lt;br /&gt;
	&lt;br /&gt;
	local detmetitem = mw.wikibase.getEntity(returnclaim.qualifiers[DetMeth_P][1].datavalue.value.id)												-- Get the current claim determination method item&lt;br /&gt;
	if detmetitem.sitelinks ~=nil and detmetitem.sitelinks.enwiki ~=nil then																		-- Check if the determination method item has an enwiki URL&lt;br /&gt;
		yearreturn = &amp;quot;[[&amp;quot;..detmetitem.sitelinks.enwiki.title..&amp;quot;|&amp;quot;.. year..&amp;quot;]]&amp;quot;																		-- If it does, use this URL as the link with the year value&lt;br /&gt;
	elseif detmetitem.claims[Instof_P] ~=nil and detmetitem.claims[Instof_P][1].mainsnak.datavalue.value.id == CensusAU_I	then					-- If there isn&amp;#039;t a populated enwiki URL for determination method item AND it&amp;#039;s a census determination method then...&lt;br /&gt;
		yearreturn = &amp;quot;[[Census_in_Australia#&amp;quot;..year..&amp;quot;|&amp;quot;.. year..&amp;quot;]]&amp;quot;																				-- ... return the population year linked to the corresponding section of the Census in Australia article&lt;br /&gt;
	end	&lt;br /&gt;
	return abbrelabel..&amp;quot; &amp;quot;..yearreturn																												-- Join the geography abbreviation to the year (with link) ready for the final output&lt;br /&gt;
end&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---------------- This ListForInfobox function is being used to grab the correct population value ---------------&lt;br /&gt;
&lt;br /&gt;
local p = {} &lt;br /&gt;
&lt;br /&gt;
function p.ListForInfobox( frame )					  &lt;br /&gt;
	local luaplacetype = &amp;quot;&amp;quot;														--Initialise the local place type&lt;br /&gt;
	if frame.args.type == nil then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	local articleplacetype = string.lower(frame.args.type)						-- Bring in the place type entered into Infobox Australian place template, change to a lower case string&lt;br /&gt;
	if articleplacetype == &amp;quot;town&amp;quot; then											-- Check which place type and match to the equivalent ABS geographic area &amp;quot;city&amp;quot;, &amp;quot;suburb&amp;quot;, &amp;quot;town&amp;quot;, &amp;quot;lga&amp;quot;, &amp;quot;region&amp;quot;&lt;br /&gt;
		luaplacetype = UCL_I&lt;br /&gt;
	elseif articleplacetype == &amp;quot;suburb&amp;quot; then&lt;br /&gt;
		luaplacetype = SAL_I&lt;br /&gt;
	elseif articleplacetype == &amp;quot;city&amp;quot; then&lt;br /&gt;
		luaplacetype = UCL_I&lt;br /&gt;
	elseif articleplacetype == &amp;quot;lga&amp;quot; then&lt;br /&gt;
		luaplacetype = LGA_I&lt;br /&gt;
	elseif articleplacetype == &amp;quot;region&amp;quot; then	-- for now saying region == LGA_I... but unclear what is most apprpriate ABS geography type.... can revise&lt;br /&gt;
		luaplacetype = LGA_I&lt;br /&gt;
	end	&lt;br /&gt;
	&lt;br /&gt;
	if frame.args.wikidata ~= nil and frame.args.wikidata ~= &amp;quot;&amp;quot; then			-- checking if there&amp;#039;s a linked Wikidata item for the article&lt;br /&gt;
		item = mw.wikibase.getEntity(frame.args.wikidata)						-- this is the default item specified by the wikidata parameter in the template&lt;br /&gt;
	else &lt;br /&gt;
		item = mw.wikibase.getEntity() 											-- If there&amp;#039;s a Wikidata item connected to the article it will find it here.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
--	mw.logObject(item)&lt;br /&gt;
	&lt;br /&gt;
 --------------- CHECK: If item.claims[Pop_P] is nil. If it is return an empty string ----------------------&lt;br /&gt;
	if item == nil or item.claims[Pop_P] == nil then&lt;br /&gt;
		return	&amp;quot;&amp;quot;										&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
------------ PART 1: Find claims with (1) point in time is not nil, (2) applies to part is not nil, (3) determination method is not nil and (4) References table is not empty-------------&lt;br /&gt;
&lt;br /&gt;
	local validpopclaims = {}													--initialise the blank claim table for storing all population claims that satisfy the four conditions &lt;br /&gt;
	z=0																			-- initialise the table row count&lt;br /&gt;
	for j, s in pairs(item.claims[Pop_P]) do&lt;br /&gt;
		if	s.qualifiers ~= nil and &lt;br /&gt;
		    s.qualifiers[Pointin_P]~= nil and&lt;br /&gt;
			s.qualifiers[Applies_P] ~= nil and &lt;br /&gt;
			s.qualifiers[DetMeth_P] ~= nil and &lt;br /&gt;
			s.references ~= nil then&lt;br /&gt;
	&lt;br /&gt;
			z=z+1																&lt;br /&gt;
			validpopclaims[z]=s													-- give the claim a new key in the table&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
--------------- CHECK: If count of validpopclaims is less than one (eg 0) then return a html message. This checks we have something from which to get a population value and basic reference.--------------&lt;br /&gt;
	if #validpopclaims &amp;lt;1 then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
--------------- PART 2: Compare claim &amp;#039;applies to part&amp;#039; values against template place type-------------------------&lt;br /&gt;
 	local templategeog = {}												--initialise the blank claim table for if the template type matches to Wikidata claim applies to part&lt;br /&gt;
	local othergeog = {}												--initialise the blank claim table for when the template type doesn&amp;#039;t match Wikidata claims applies to part&lt;br /&gt;
	local c=0&lt;br /&gt;
	local d=0&lt;br /&gt;
	for i, q in pairs(validpopclaims) do&lt;br /&gt;
		if q.qualifiers[Applies_P][1].datavalue.value.id == luaplacetype then		--filter for claims where applies to part = Infobox template type&lt;br /&gt;
			c=c+1																	-- give the claim a new key in the table											&lt;br /&gt;
			templategeog[c]=q														-- claims with Infobox template type geography&lt;br /&gt;
		else&lt;br /&gt;
			d=d+1&lt;br /&gt;
			othergeog[d]=q															-- claims with geography other than specified in the Infobox template type.&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
----------PART 3: Get claims with the maximum &amp;#039;Point in time&amp;#039; values ------------------&lt;br /&gt;
----------PART 3A: Find the max date of claims with template geography-----------------&lt;br /&gt;
&lt;br /&gt;
	local maxclaimspertemplategeog = nil												--initialise the blank claim corresponding to the max date&lt;br /&gt;
	for k, v in pairs(templategeog) do													--loop through all the claims with geography type = Infobox template type&lt;br /&gt;
		local tclaimdate = v.qualifiers[Pointin_P][1].datavalue.value.time&lt;br /&gt;
		if  maxclaimspertemplategeog == nil&lt;br /&gt;
			or (maxclaimspertemplategeog ~= nil&lt;br /&gt;
				and tclaimdate &amp;gt;= maxclaimspertemplategeog.qualifiers[Pointin_P][1].datavalue.value.time)&lt;br /&gt;
			then								 &lt;br /&gt;
				maxclaimspertemplategeog=v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----------PART 3B: Find the max date of claims with non-Infobox template geography-----------------&lt;br /&gt;
&lt;br /&gt;
	local maxclaimsperothergeog = {}&lt;br /&gt;
&lt;br /&gt;
	for l, m in pairs(othergeog) do														--loop through all the claims with geography type = non Infobox place type&lt;br /&gt;
		local oclaimdate = m.qualifiers[Pointin_P][1].datavalue.value.time&lt;br /&gt;
		local claimgeog = m.qualifiers[Applies_P][1].datavalue.value.id&lt;br /&gt;
		if  maxclaimsperothergeog[claimgeog] == nil										-- using the applies to part value as the table key&lt;br /&gt;
			or (maxclaimsperothergeog[claimgeog] ~= nil&lt;br /&gt;
				and oclaimdate &amp;gt;= maxclaimsperothergeog[claimgeog].qualifiers[Pointin_P][1].datavalue.value.time)  -- checking the max date for a particular geography value&lt;br /&gt;
			then								 &lt;br /&gt;
				maxclaimsperothergeog[claimgeog]=m										-- overwrites with a geography-max date claim pair whenever the point in time is bigger than the last iteration.&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
------------------------------Compiling the module output--------------------------------	    &lt;br /&gt;
&lt;br /&gt;
	local returnlist = {}																							-- Initiate an empty table to store the output claims&lt;br /&gt;
    if maxclaimspertemplategeog ~=nil then													-- Situation 1: Getting population for max date claim where applies to part matches the Infobox place type&lt;br /&gt;
		local templategeogrefs = GetRefsForClaim(maxclaimspertemplategeog, item.labels.en.value)					-- Getting the references for max date claim where Wikidata applies to part matches the Infobox place type&lt;br /&gt;
		table.insert (returnlist, mw.language.getContentLanguage():formatNum(tonumber(maxclaimspertemplategeog.mainsnak.datavalue.value.amount))..&amp;quot; (&amp;quot;..GetAbbrLabelYearLink(maxclaimspertemplategeog)..&amp;quot;)&amp;quot;..templategeogrefs)  --Insert the return string to returnlist. With population value, applies to part, point in time, reference &lt;br /&gt;
   &lt;br /&gt;
    elseif articleplacetype == &amp;quot;town&amp;quot; then													-- Situation 2: Getting population for max date claims where Infobox place type = town. If no UCL populations (earlier default) then get ILOC and SAL populations.&lt;br /&gt;
    	if maxclaimsperothergeog[ILOC_I]~=nil then&lt;br /&gt;
			local ILOCrefs = GetRefsForClaim(maxclaimsperothergeog[ILOC_I], item.labels.en.value)					-- Getting the references for max date claim where applies to part = ILOC&lt;br /&gt;
			table.insert (returnlist, mw.language.getContentLanguage():formatNum(tonumber(maxclaimsperothergeog[ILOC_I].mainsnak.datavalue.value.amount))..&amp;quot; (&amp;quot;..GetAbbrLabelYearLink(maxclaimsperothergeog[ILOC_I])..&amp;quot;)&amp;quot;..ILOCrefs) --Insert the return string to returnlist. With population value, applies to part, point in time, reference &lt;br /&gt;
    	end&lt;br /&gt;
		if maxclaimsperothergeog[SAL_I]~=nil then&lt;br /&gt;
			local SALrefs = GetRefsForClaim(maxclaimsperothergeog[SAL_I], item.labels.en.value)						-- Getting the references for max date claim where applies to part = SAL&lt;br /&gt;
			table.insert (returnlist, mw.language.getContentLanguage():formatNum(tonumber(maxclaimsperothergeog[SAL_I].mainsnak.datavalue.value.amount))..&amp;quot; (&amp;quot;..GetAbbrLabelYearLink(maxclaimsperothergeog[SAL_I])..&amp;quot;)&amp;quot;..SALrefs)		--Insert the return string to returnlist. With population value, applies to part, point in time, reference&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		for a, w in pairs(maxclaimsperothergeog) do											-- Situation 3: Getting population for max date claims where applies to part doesn&amp;#039;t = Infobox place type, and Infobox place type doesn&amp;#039;t = town.&lt;br /&gt;
			local othergeogrefs = GetRefsForClaim(w, item.labels.en.value)											-- Loop through the claims in maxclaimsperothergeog and output all of them&lt;br /&gt;
			table.insert (returnlist, mw.language.getContentLanguage():formatNum(tonumber(maxclaimsperothergeog[a].mainsnak.datavalue.value.amount))..&amp;quot; (&amp;quot;..GetAbbrLabelYearLink(maxclaimsperothergeog[a])..&amp;quot;)&amp;quot;..othergeogrefs)  	--Insert the return string to returnlist. With population value, applies to part, point in time, reference&lt;br /&gt;
		end &lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local wikitext = &amp;quot;&amp;quot;																								-- Initialise an empty string output (this is the value that goes back to the Infobox Australian place)					&lt;br /&gt;
    if #returnlist == 1 then																						-- If there is only one formatted &amp;quot;population (geography year)&amp;quot; string (one row) in returnlist then return it without a bullet point&lt;br /&gt;
    	wikitext = returnlist[1]&lt;br /&gt;
    else&lt;br /&gt;
    	wikitext = &amp;quot;\n*&amp;quot;..table.concat(returnlist,&amp;quot;\n*&amp;quot;)															-- If there are multiple formatted &amp;quot;population (geography year)&amp;quot; strings (multiple rows) in returnlist then return all the rows with new line and bullet points between them&lt;br /&gt;
    end	&lt;br /&gt;
	return  wikitext..&amp;#039;[[Category:Australian place articles using Wikidata population values]]&amp;#039;						-- Append the category to the output so we can keep track of which articles are using this module to output a population value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;MaiaCWilliams</name></author>
	</entry>
</feed>