Module talk:Country population

This is an old revision of this page, as edited by Jts1882 (talk | contribs) at 12:34, 13 June 2021 (Template wrapper). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 4 years ago by Jts1882 in topic Template wrapper

Static Row Numbers

Hey, Jts1882, would {{srn}} be useful in this module? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 21:59, 2 May 2021 (UTC)Reply

  Done
FYI, you can't just add templates or tags to wikitext output generated in a module, as they won't expand properly. You need to use frame:expandTemplate or frame:extensionTag
P.S. I don't think the template {{srn}} is a good idea. It's to short to make it clear what it does and looks like one of the short note citation template, which could confuse people. Better to use the full template name which gives an indication of what it is doing. —  Jts1882 | talk  08:56, 5 May 2021 (UTC)Reply
Ok. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 09:06, 5 May 2021 (UTC)Reply

Bottom alignment

Jts1882: Rows seem to be valigned to the bottom. I had a look at the code, and could only find bottom alignment for the header row, which is fine. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 01:07, 5 May 2021 (UTC)Reply

Flaglist vs Flagcountry

Jts1882: Wouldn't {{flaglist}} be better for alignment than {{flagcountry}} here? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 01:28, 5 May 2021 (UTC)Reply

Template wrapper

I started a template wrapper for this module bc I wanted to pass the list of countries as a template (like the {{List of countries in South America}}), bc the MW engine processes modules before templates. The main function here is commented with called from template, but I got stuck passing through the arguments. Did you already create the template you referred to there, Jts1882, or can you help me beat that one into shape? Cheers. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚  08:17, 13 June 2021 (UTC)Reply

The main() function wasn't doing anything. The module was using p.populations().
When a module is called directly from #invoke the arguments are in frame.args. The function p.populations() uses these frame arguments. I've split p.populations to have an entry point for invoke that gets the frame arguments and calls p._populations() to generate the table.
When called from a template the arguments are in the parent frame. I've changed main() to get the parent frame arguments and then call p._populations() so it now seems to work for the template. Not an ideal approach but an easy change for now. —  Jts1882 | talk  10:04, 13 June 2021 (UTC)Reply


CountryProjected population
(2 September 2025)
Pct of
total
UN Population estimatesAnnual growth[a]Doubling time
(years)[b]
1 July 20231 July 2022IncrementRate
  Brazil212,965,31948.56%211,140,729210,306,415834,3140.40%175
  Colombia53,611,36812.22%52,321,15251,737,944583,2081.13%62
  Argentina45,823,29610.45%45,538,40145,407,904130,4970.29%242
  Peru34,664,2797.90%33,845,61733,475,438370,1791.11%63
  Venezuela28,492,6886.50%28,300,85428,213,01787,8370.31%223
  Chile19,890,7394.54%19,658,83519,553,036105,7990.54%128
  Ecuador18,324,2474.18%17,980,08317,823,897156,1860.88%79
  Bolivia12,615,1062.88%12,244,15912,077,154167,0051.38%50
  Paraguay7,029,5961.60%6,844,1466,760,46483,6821.24%56
  Uruguay3,381,9350.77%3,388,0813,390,913−2,832−0.08%−830
  Guyana836,6960.19%826,353821,6374,7160.57%121
  Suriname641,5030.15%628,886623,1645,7220.92%76
  French Guiana314,7790.07%303,402298,3065,0961.71%41
  Falkland Islands3,4490.00%3,4773,490−13−0.37%−186
Total438,594,999100%433,024,175430,492,7792,531,3960.58%118
I wonder what I need to do to get this to work:
CountryProjected population
(2 September 2025)
Pct of
total
Annual growthDoubling time
(years)
IncrementRate
  Brazil212,965,31948.56%834,3140.40%175
  Colombia53,611,36812.22%583,2081.13%62
  Argentina45,823,29610.45%130,4970.29%242
  Peru34,664,2797.90%370,1791.11%63
  Venezuela28,492,6886.50%87,8370.31%223
  Chile19,890,7394.54%105,7990.54%128
  Ecuador18,324,2474.18%156,1860.88%79
  Bolivia12,615,1062.88%167,0051.38%50
  Paraguay7,029,5961.60%83,6821.24%56
  Uruguay3,381,9350.77%−2,832−0.08%−830
  Guyana836,6960.19%4,7160.57%121
  Suriname641,5030.15%5,7220.92%76
  French Guiana314,7790.07%5,0961.71%41
  Falkland Islands3,4490.00%−13−0.37%−186
Total438,594,999100%2,531,3960.58%118
  1. ^ Cite error: The named reference UN was invoked but never defined (see the help page).


Cite error: There are <ref group=lower-alpha> tags or {{efn}} templates on this page, but the references will not show without a {{reflist|group=lower-alpha}} template or {{notelist}} template (see the help page).