User:DaisyGeekyTransGirl/sandbox II/doc

From Wikipedia, the free encyclopedia


This is a navbox template intended for "Year in country" articles for African countries. Based on the input year, it contains all countries in Africa in that year, linked to the respective "Year in country" article, if that doesn't exist the "Decade in country" article, and if that doesn't exist either the "History of country" article.

This template is based on {{Year in Europe}} and therefore uses mostly the same parameters. The template may not yet contain all former countries, though the goal is to make it accurate for all years after 1000.

Parameters[edit]

  • {{{1}}} (first unnamed parameter): The year (required; if unspecified or not numeric an error message is given)
  • {{{title}}}: A custom title (default: "<year> in Africa", linked if an article with that name exists)
  • {{{state}}}: "expanded", "collapsed" or "autocollapse" (see {{collapsible option}})

Furthermore, the link to each country can be individually set using the following parameter names. If set to nothing it omits the country entirely. These parameters also work if a country is omitted by default because it didn't exist in the given year.

Current countries (ISO 3166-1 codes)
  • DZ – Algeria (also as colony)
  • AO – Angola
  • BJ – Benin
  • BW – Botswana
  • BF – Burkina Faso
  • BI – Burundi
  • CM – Cameroon
  • CV – Cape Verde
  • CF – Central African Republic
  • TD – Chad (also as colony)
  • KM – Comoros
  • CD – Democratic Republic of the Congo
  • CG – Republic of the Congo
  • DJ – Djibouti
  • EG – Egypt
  • GQ – Equatorial Guinea
  • ER – Eritrea
  • ET – Ethiopia
  • GA – Gabon
  • GM – The Gambia
  • GH – Ghana
  • GN – Guinea
  • GW – Guinea-Bissau
  • CI – Ivory Coast
  • KE – Kenya
  • LS – Lesotho
  • KW – Kuwait
  • KG – Kyrgyzstan
  • LA – Laos
  • LB – Lebanon
  • MY – Malaysia
  • MV – Maldives
  • MN – Mongolia (also as unrecognised country)
  • NP – Nepal
  • OM – Oman
  • PK – Pakistan
  • PH – Philippines
  • QA – Qatar
  • RU – Russia
  • SA – Saudi Arabia
  • SQ – Singapore
  • LK – Sri Lanka
  • SY – Syria
  • TJ – Tajikistan
  • TH – Thailand
  • TR – Turkey
  • TG – Togo
  • TN – Tunisia
  • UG – Uganda
  • ZM – Zambia
  • ZW – Zimbabwe
Current dependencies (ISO 3166-1 codes)
  • IO – British Indian Ocean Territory
  • CX – Christmas Island
  • CC – Cocos (Keeling) Islands
  • HK – Hong Kong
  • MO – Macau

States with limited recognition (ISO 3166-1 user-assigned codes)

  • XEH – Sahrawi Democratic Arab Republic
  • XSO – Somaliland

Former countries (ISO 3166-1 and ISO 3166-3 codes)

  • DHY – Dahomey
  • HV – Upper Volta
  • ZR – Zaire

Former countries (ISO 3166-1 user-assigned codes)

  • XMA – British Malaya
  • XIN – British Raj
  • XBY – Byzantine Empire
  • XLK – Ceylon (changed to Sri Lanka)
  • XGB – Colony of Aden
  • XNL – Dutch East Indies
  • XFN – French India
  • XFI – French Indochina
  • XKR – Korea
  • XMY – Malaya (changed to Malaysia)
  • XIQ – Mandatory Iraq
  • XPS – Mandatory Palestine
  • XSY – Mandatory Syria
  • XMN – Mongol Empire
  • XOT – Ottoman Empire
  • XCN – Tibet
  • XJO – Transjordan
  • XVN – South Vietnam

It's technically possible to input non-integer years like 1976.5, but that wouldn't make much sense, and year articles are not likely to exist for such years.

Examples[edit]

{{Year in Africa|2000}}

Example with custom title and links:

{{Year in Africa|2000|title=Title|ID=Custom link for Sierra Leone}}

Note the (red) custom link for Sierra Leone.

Code for adding countries[edit]

* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|Years|name=Country name}}

"Years" is a series of up to six unnamed parameters where each pair of two identifies a time period in which the country existed. Omit either for an unbounded interval (since the first year or until the second year). Some examples:

Code Interval Country included in years
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1100|1300|name=Name}} [1100, 1300) 1100–1300
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1100|1300|1500|1700|name=Name}} [1100, 1300), [1500, 1700) 1100–1300 and 1500–1700
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1100|name=Name}} [1100, +∞) since 1100
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1300|name=Name}} (−∞, 1300) until 1300
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1100|1300|1500|name=Name}} [1100, 1300), [1500, +∞) from 1100 until 1300 and after 1500
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|1100|1300|name=Name}} (−∞, 1100), [1300, +∞) before 1100 and after 1300
* {{Year in Africa/expr|{{{1}}}|{{{Code|♦}}}|name=Name}} (−∞, +∞) always

By design, each interval includes the left endpoint and excludes the right endpoint. A country with the coding from the first example would therefore be listed if the input year is 1100, but not if the input year is 1300.

Limits[edit]

This template uses two {{#ifexist}} parser functions for each included country. Because {{#ifexist}} is an expensive parser function, only 500 of these may be used on a given page (see Wikipedia:Template limits). Depending on the number of countries in the given year, this template can therefore be transcluded only a few times on the same page, and if a page already uses a lot of expensive parser functions, adding it may cause the page to be automatically added to Category:Pages with too many expensive parser function calls.