Hello,
The lastest (and greatest) version of the factbook library [1],
that is, v1.1.1
now includes a new almanac class that lets you build your own world almanac
e.g. listing all the world's 260+ countries and territories with
capitals, population,
internet users, mobile telephone subscripts/100, religions, ethnic
groups, languages, and so on. See ALMANAC.md [2] as an example.
How to build your own in three steps:
Step 1: Get a copy of the factbook.json archive
Use git clone (or unpack the zip archive) using
factbook/factbook.json [3] github repo.
Step 2: Load the profiles using the Almanac class
almanac = Factbook::Almanac.from_json( Factbook.codes.countries,
json_dir: './factbook.json' )
Step 3: Use your template of choice and render / build the Almanac text corpus
TEMPLATE = <<EOS
### <%= page.name %>
<%= page.capital %> • <%= page.area %> • pop. <%= page.population %>
...
EOS
puts almanac.render( TEMPLATE )
That's it. See the scripts/almanac.rb [4] as an example. Cheers.
PS: Bonus Question - Name the largest country in Africa:
A) Nigeria
B) South Africa
C) Kongo
D) Algeria Anyone?
[1] https://github.com/worlddb/factbook
[2] https://github.com/factbook/factbook.json/blob/master/ALMANAC.md
[3] https://github.com/factbook/factbook.json
[4] https://github.com/worlddb/factbook/blob/master/script/almanac.rb