Module talk:Country population: Difference between revisions

Content deleted Content added
remove page from Special:WantedTemplates
 
(9 intermediate revisions by 6 users not shown)
Line 28:
 
::I wonder what I need to do to get this to work:
::{{Country populations|hide_years=true|ARG|BOL|BRA|COL|PER|VEN|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK}}
:::Yeah, well, I know it works like that{{--}}{{tlx|Country populations|hide_years=true|ARG|BOL|BRA|COL|PER|VEN|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK}}{{--}}but what I really wanted was:
:::<code><nowiki>{{Country populations|{{List of countries in South America|ISO=y}}}}</nowiki></code>
:::<nowiki>{{Country populations|{{List of countries in South America|ISO=y}}}}</nowiki>
:::The motive here is replicating the good work you did with {{tl|Country populations}} to, say, {{tl|Country areas}}, {{tl|Country densities}}, etc, so that the list of countries in each region could be centrally maintained in a single template for each. — [[User:Guarapiranga|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]]&nbsp;[[User talk:Guarapiranga|☎]] 21:59, 13 June 2021 (UTC)
:::: The problem there is that the result of that is to set parameter <nowiki>{{para|1|{{List of countries in South America|ISO=y}}}}</nowiki>.
:::: I don't think you can use a template to supply a series of parameters. The solutions is to get the module to handle a list (e.g. comma delimited). If the module is handling it, then the lists may as well be stored in a subpage and be provided a via a parameter, e.g. {{para|list=South America}}. —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 08:24, 14 June 2021 (UTC)
 
Line 39:
 
The above table is generated with <code><nowiki>{{Country populations|list=North America}}</nowiki></code>. The list of countries is stored in a table as follows:
{{smalldiv|1=
<small>
<pre>
local country_lists = {
Line 46:
['Arab countries'] = { "EGY","DZA","SDN","IRQ","MAR","SAU","YEM","SYR","TUN","JOR","ARE","LBN","LBY","PSE","OMN","KWT","MRT","QAT","BHR","DJI","COM" }
}
</pre></small>}}
At the moment it is just a local variable in the function, but I suggest putting them in a subpage of the module. Then the subpage can be used by other modules. —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 16:26, 14 June 2021 (UTC)
 
:Yep, that's useful. Unfortunately, the other aim I had in mind [[User:Guarapiranga/sandbox/4|''no worky'']] — [[User:Guarapiranga|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]]&nbsp;[[User talk:Guarapiranga|☎]] 06:05, 15 June 2021 (UTC)
 
== Bug ==
Something's gone awry with the module, {{u|Jts1882}}. Look at the missing 2nd figures column heading, and that the projected populations are lower than the latest (2019) estimate: [[List of African countries by population]]. Cheers. — [[User:Guarapiranga|Guarapiranga]]&nbsp;[[User talk:Guarapiranga|☎]] 03:20, 29 July 2021 (UTC)
: The module gets the dates and data from [[List of countries by population (United Nations)]]. You changed the section labels with [https://en.wikipedia.org/w/index.php?title=List_of_countries_by_population_(United_Nations)&diff=prev&oldid=1028473924 this edit], so the date calculations no longer work correctly. You can also see that the first date column header is missing in [[List of African countries by population]]. —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 07:09, 29 July 2021 (UTC)
 
: Yes, and additionally in [[List of African countries by population]], [[Guinea-Bissau]] is missing. Does anyone know what is causing this bug? I wasn't able to follow the explanation above. I can't see anything problematic in the UN source list. [[User:Cstanford.math|Cstanford.math]] ([[User talk:Cstanford.math|talk]]) 19:19, 2 September 2021 (UTC)
:: {{ping|Cstanford.math}}. The section labels weren't set properly in the page with the population data ([[List of countries by population (United Nations)]]). I've set them now (with [https://en.wikipedia.org/w/index.php?title=List_of_countries_by_population_(United_Nations)&diff=1042107588&oldid=1040221976 this edit]) and the previous module version of [https://en.wikipedia.org/w/index.php?title=List_of_African_countries_by_population&action=submit List of African countries by population] seems to work (you may need to display it in edit preview due to caching). —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 07:22, 3 September 2021 (UTC)