Redirect to:
This template does not require a rating on Misplaced Pages's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
Flag variant
@Sillyfolkboy: I noticed that the new flag of Mauritania is displayed when using this template in 2009 World Championships in Athletics – Men's 1500 metres, but the new design has only been in use since 2017. Is there a way to fix this globally so that always the flag used at the time of the championships is displayed? I think the corresponding template for the Olympics always displays the correct flag variant. Pietaster (talk) 22:27, 24 March 2018 (UTC)
- @Pietaster: Thanks for pointing that out. The third parameter on {{flaglinkteam}} was overloaded, taking in both flag variant field and number of athletes. I have now separated these so the third parameter is for the flag variant and fourth parameter is for the lesser used athlete total. I can see User:Primefac has nicely written up a bit of Lua code at Module:Country alias which does a value comparison on the competition's year and the various national flag variant. Great work there! Something I've wanted to do for years. I've implemented the changes now and handled for the issue of full country names so the three-letter-code always shows now. Primefac: any recommendations on good material to start with for learning Lua? I'm still working in the template world, which gets lengthy coding-wise whenever you need to simulate a stored parameter... SFB 05:10, 25 March 2018 (UTC)
- Sillyfolkboy, for learning Lua all I did was dive in and try making something. On test2 server, as Scributno was not deployed on the main server and it let me break things without consequence. But you could do the same here in a sandbox, in userspace or in some other way to not impact live articles. Then I just used the documentation; now you have the benefit of many working examples. Once you get started it is easier than using parser functions, as Lua is much better suited to all but the simplest of tasks.--JohnBlackburnedeeds 16:08, 25 March 2018 (UTC)
The recent changes seem to have broken a large number of articles. adding the following to Category:Pages with script errors:
I had a look at a couple and could not see anything wrong with the articles.--JohnBlackburnedeeds 13:29, 25 March 2018 (UTC)
- I've rolled back the changes and cleared out the cat - I seem to recall there was a reason I left that family of templates alone, but I'll take a look later today and see about what needs doing. Primefac (talk) 14:35, 25 March 2018 (UTC)
- @Primefac and JohnBlackburne: There were some non-standard country codes in use that I've now added workarounds for (e.g. GRB for Great Britain, NFK for Norfolk Islands). I've restored the change and reviewed all the pages above and no errors showing now. Presumably this was kept separate as IAAF have their own country codes, and also there is a lot of weird usage going on with this template. Template:IAAFAlias should return the right three letter code to the Country Alias module even if weird codes and full country names are used instead of a standard code. It's not elegant, but it should work.
- I'm sure this template could be better written in Lua. The only unusual thing this group of templates is doing is page name parsing to link to the country articles. There are only two operations needed for that: (a) strip out all string after and including an endash if one present, and (b) strip out all string before and including the phrase " at the ". That will turn something like Athletics at the 2008 Summer Olympics – Men's 100 metres and 2010 European Athletics Championships – Women's marathon into "2008 Summer Olympics" and "2010 European Athletics Championships", respectively. I've also added a simple striptonumbers to grab the year in the pagename (always first number in the title) and feed that into the country alias module. SFB 19:46, 25 March 2018 (UTC)