Content deleted Content added
Guarapiranga (talk | contribs) m signature |
remove page from Special:WantedTemplates |
||
(29 intermediate revisions by 6 users not shown) | |||
Line 1:
== Static Row Numbers ==
Hey, {{u|Jts1882}}, would {{tl|srn}} be useful in this module? [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 21:59, 2 May 2021 (UTC)
: {{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 <code>frame:expandTemplate</code> or <code>frame:extensionTag</code>
: P.S. I don't think the template {{tl|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. — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </span> 08:56, 5 May 2021 (UTC)
::Ok. [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 09:06, 5 May 2021 (UTC)
== Bottom alignment ==
{{u|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. [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 01:07, 5 May 2021 (UTC)
== Flaglist vs Flagcountry ==
{{u|Jts1882}}: Wouldn't {{tl|flaglist}} be better for alignment than {{tl|flagcountry}} here? [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 01:28, 5 May 2021 (UTC)
== Template wrapper ==
I started a [[Template:Country populations|template wrapper]] for this module bc I wanted to pass the list of countries as a template (like the {{tl|List of countries in South America}}), bc the MW engine processes modules before templates. The main function here is commented with ''{{tq|called from template}}'', but I got stuck passing through the arguments. Did you already create the template you referred to there, {{u|Jts1882}}, or can you help me beat that one into shape? Cheers. — [[User:Guarapiranga|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] [[User talk:Guarapiranga|☎]] 08:17, 13 June 2021 (UTC)
: 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. — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </span> 10:04, 13 June 2021 (UTC)
{{Country populations|ARG|BOL|BRA|COL|PER|VEN|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK
|hide_years=false
|growth_note={{efn|Population growth calculation from UN estimates for 2019 and 2020.<ref name="UN"/>}}
|doubling_note={{efn|At the current growth rate (halving time for negative numbers).}}
}}
::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|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] [[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}}. — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </span> 08:24, 14 June 2021 (UTC)
{{Country populations|list=North America}}
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=
<pre>
local country_lists = {
['South America'] = { "ARG","BOL","BRA","CHL","COL","ECU","GUY","PRY","PER","SUR","URY","VEN","BVT","FLK","SGS","GUF" },
['North America'] = { "ATG","BHS","BLZ","BRB","CAN","CRI","CUB","DMA","DOM","GRD","GTM","HND","HTI","JAM","KNA","LCA","MEX","NIC","PAN","SLV","TTO","USA","VCT" },
['Arab countries'] = { "EGY","DZA","SDN","IRQ","MAR","SAU","YEM","SYR","TUN","JOR","ARE","LBN","LBY","PSE","OMN","KWT","MRT","QAT","BHR","DJI","COM" }
}
</pre>}}
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. — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </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|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] [[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]] [[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]]. — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </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). — <span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;"> [[User:Jts1882|Jts1882]] |[[User talk:Jts1882| talk]] </span> 07:22, 3 September 2021 (UTC)
|