Template talk:CIA World Factbook

WikiProject iconUnited States: Military history / Government Template‑class
WikiProject iconThis template is within the scope of WikiProject United States, a collaborative effort to improve the coverage of topics relating to the United States of America on Wikipedia. If you would like to participate, please visit the project page, where you can join the ongoing discussions.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.
Taskforce icon
This template is supported by WikiProject Military history - U.S. military history task force.
Taskforce icon
This template is supported by WikiProject U.S. Government.


Inline

Please make it support |inline=1 like {{EB1911}} and many others. – Finnusertop (talkcontribs) 13:57, 5 May 2019 (UTC)[reply]

See Template talk:Country study#Inline where you, Trappist the monk, and I discussed this same parameter. The conclusion of the discussion is that |inline= is not helpful there. I would generalize that to any template built on {{Include-USGov}}: they all work inline already, and saying "the previous sentences" makes the notice fragile to future editing. —hike395 (talk) 14:55, 5 May 2019 (UTC)[reply]
I'm not sure that I have anything to say beyond what I said in that other conversation.
—Trappist the monk (talk) 16:36, 5 May 2019 (UTC)[reply]

URL Change

The CIA World Factbook is now at https://www.cia.gov/the-world-factbook/, and countries are referenced by name rather than country code. — Preceding unsigned comment added by MasqueOfTheRedDeath (talkcontribs) 19:25, 17 January 2021 (UTC)[reply]

Archive

The Year parameter no longer works because the site has changed its policy to save itself a halfpence of disk space. The previous years are now stored as zip files by year in

  • https://www.cia.gov/the-world-factbook/about/archives

therefore this template needs reworking. I suggest that if the year parameter is set then the year links to the archive, and the reader can download the year specified. Or alternately the year can link to the appropriate zip file. Thoughts?

I also suggest also that the article name should reworked so that the underlying link is to that article (at the moment unless a specific url is given it just links to the site. This would mean that all that needs doing is to add article=Angola and have a look up table to match it to the correct extension

url=https://www.cia.gov/the-world-factbook/countries/{{#switch{{{article}}}:Angola=angola|...}}

Thoughts?

-- PBS (talk) 13:53, 24 September 2022 (UTC)[reply]

I think I've modified the template to do what you want:
  1. If year is set, I send the readers to archive.org as of 2017 (because the archives still worked back then)
  2. If the article is set and no url is given, I munged the article name to generate the url that the CIA wants.
Please let me know if something isn't working, or feel free to change the template yourself. — hike395 (talk) 20:08, 24 September 2022 (UTC)[reply]
@User:Hike395 Thank you. I had not thought about using {{lc}} and that will work for most if not all countries. The use of {{replace}} to replace the space(s) in country names such as "United States" is also a good idea.
Your solution for archived years up to 2017 is elegant. What do we do for the years 2018 forwards? The template could pull out specific web.archive.org pages or it could point to the ftp page. The advantage of the former is that it is an html page, the disadvantage is the template will probably have to be updated yearly, the ftp option is the reverse. What do you [or others] think we should do for years after 2017?
-- PBS (talk) 14:33, 25 September 2022 (UTC)[reply]
Now I understand your first comment, above, and no longer link to archive.org, but a zip file that is hosted on the CIA website. So all of the years should work now. — hike395 (talk) 14:43, 25 September 2022 (UTC)[reply]

Archive and beyond

@User:Hike395 What you have done so far fixes most of the problems. I have created a sandbox version and test cases.

One test case that does not work as I expected is a combination of "article", and "year". All that is shown is "article". I think it should show archive_year and article. One case we need to consider if this is done, is if someone set the year to the current year. In that case we ought not to link to an archive and just display the year. What are you thought on this?

I have added "first" and "last" parameters in the test version, so that in a Wikipedia article if an instance is in a bullet pointed reference list, it can be linked via a short citation in a {{reflist}}. The odd way I have formatted the "first" and "last" parameters is because without doing that the {{cite web}} lua module winges if no values are given.

-- PBS (talk) 16:20, 25 September 2022 (UTC)[reply]

Added three fixes/features:
  1. Now all parameters are passed along to {{Include-USGov}} (which, under some circumstances, passes them to {{cite web}})
  2. Per your suggestion, if year >= 2021, links to the current version, not the archive
  3. Per your suggestion, if both article and year are given, they are combined in the title.
Now live. — hike395 (talk) 19:05, 25 September 2022 (UTC)[reply]
A better idea just occurred to me. This template did not call {{Include-USGov}} correctly. It listed CIA World Factbook as the agency, but in fact, the agency is CIA, and the World Factbook is a work by the CIA. When I changed the template to reflect this, the output looks much more like other {{cite web}} usage in WP. I think this is better, although we can revert/change if PBS or other people object. — hike395 (talk) 20:01, 25 September 2022 (UTC)[reply]
It is probably best to replace 2021 with
{{CURRENTYEAR}} - 1
it will help in future proofing.
I liked your "year edition" display in previous version. If the article parameter is set and the year is set can we have the current CIA article displayd with its url and simultaniously display "year edition" with a url, perhapes using the edition parameter (or some other suitable one)? If not then it could simply be dispayed after the contents of the {{cite web}} template have been displayed.
My thinking here is the current on line version will usually be close enough for most people, but those who need the exact figures they can check in the zip file. My reasoning here is the current version is easily accessible on most devices, but if someone is using an android phone or tablet, (s)he will probably not have an app[lication program] that can easily unbundle the zip file and display most of the zip file contents it in a meaningful way.
-- PBS (talk) 22:30, 25 September 2022 (UTC)[reply]
@PBS: Good idea. I've attempted to implement it in the sandbox. Instead of using |year= in {{cite web}}, I've used |edition=. For recent years, I just left |edition= alone. For earlier years, I do some trickery to make the edition have an external link out to the zip file (per your suggestion, above). The only sad thing about this trickery is that the COiN metadata won't be correct, but I guess that is not important. Take a look at the testcases --- what do you think? — hike395 (talk) 00:15, 26 September 2022 (UTC)[reply]

First class job. I see you got around the COiN metadata problem by tacking the information as an string line displayed {{cite web}} is called having set postscript :-) I think the test version should go live now.

Now that any and all {{cite web}} parameters can be used. I think there is a need either to disable the date as a parameter (We can document that), or to handle it some other way.

As a further iteration, the only fettling I think might make it clearer are:

  • If year is less than {{CURRENTYEAR}} - 1 then the edition kicks in, but in which case the article name ought to be preceded by Current edition or something similar giving an output such as "Current edition: Angola". This I think would make it clearer to the reader that the year that the data is derived is not necessarily wholly under the url attached to the current article.
  • In the longer term insisting that a year parameter is set if the article parameter is set. Currently this would cause problems in many articles where there is no year parameter set at the moment, so I think a bot job would need to be run before this was implemented putting in a year parameter to those temples without one.

Thoughts?

-- PBS (talk) 10:24, 26 September 2022 (UTC)[reply]

The sandbox has what I've come up with: I always set |edition={{CURRENTYEAR}}, and I change the postscipt to say "(Archived {{{year}}} link)" to make it clear that it's an archive. I wanted to keep the metadata "clean" and not muck up the title with extraneous words. Does that look good to you? I've done something similar over at {{CIA World Factbook link}}, in response to the discussion at User talk:Hike395#New template and the editing back-n-forth at Arabs.
One nice thing about wrapping {{cite web}} is that people can always add |archive-url= and |archive-date= if they want to add a link to a specific page, rather than linking to the large zip file. We can add that to the documentation.
Re: always having year set when article is set --- indeed, that is a job for AWB. I'm slowly adding {{CIA World Factbook link}} to articles, and there is a simple regex that isolates the year \|\s*access-?date[^}\|]+(20\d\d) . Would you like to use AWB to add year to instances of this template?
Re: date --- Why does it need to be suppressed? I'm not sure whether the CIA does continuous updates: the date might be useful. — hike395 (talk) 12:55, 26 September 2022 (UTC)[reply]
Yes that looks better. I would, but I am running a large AWB script myself at the moment and this is a side show to that. It will be some time before I could run one specifically searching for this template. However I am coming across a lot of instances of these templates in my current AWB script so I will add the code to handle any I come across.
Sigh you are right about date and year. Last time I checked COiN winged about both being set now it only complains if the year is different. I set up three tests with date set to 2022 and 2015 with a year parameter and one consisting of a date without a year parameter. If displays the date as "11 June 2015" but does not display an archive (because the year is not set) is that what an editor who has not looked under the bonnet would intuitively expect to happen? -- PBS (talk) 13:27, 26 September 2022 (UTC)[reply]
I think a wee bit of Lua can transform a year and a date into an archive URL. Let me take a crack at it (although busy IRL). — hike395 (talk) 18:40, 26 September 2022 (UTC)[reply]
@PBS: I couldn't resist, wrote a little bit of Lua to generate the archive link. Now used in the sandbox, PTAL. — hike395 (talk) 21:00, 26 September 2022 (UTC)[reply]
 Done --- live now. — hike395 (talk) 03:21, 27 September 2022 (UTC)[reply]

Well done, that seems to have gold plated it. Now for someone to come up with a scenario that does not fit:-(

I will update the documentation, over the next few days. That seems to be the least I can do, given that you have done all the coding. -- PBS (talk) 13:47, 27 September 2022 (UTC)[reply]

 Done -- PBS (talk) 13:02, 28 September 2022 (UTC)[reply]

MOS:REFERENCES

What would be the preferred location of templates similar to {{CIA World Factbook}}? I'd like to add such a recommendation to MOS:REFERENCES

  • The top of § References
  • The bottom of § References
  • The top of §§ Sources, Bibliography, etc
  • other locations

— CJDOS, Sheridan, OR (talk) 11:38, 7 October 2022 (UTC)[reply]

Edit request 28 July 2023

Greetings and felicitations. I made two minor corrections to the template, but I can't figure out how to make the third. Would someone please be so kind as to italicize "The World Factbook" in the cases of "No parameters set" "date set", and "date set to an earlier year"? —DocWatson42 (talk) 03:01, 29 July 2023 (UTC)[reply]

 Done (very belatedly) — hike395 (talk) 13:52, 9 April 2024 (UTC)[reply]
Thank you. ^_^ —DocWatson42 (talk) 19:43, 9 April 2024 (UTC)[reply]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template_talk:CIA_World_Factbook&oldid=1218264844"