Page permanently protected

Template:Categories by date/list

From Wikisource
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

For editors

Normal usage

All templates using the system have identical usage. The output will change depending on what information you provide it:

  • year categories: provide the century, decade, and year digits;
  • decade categories: provide the century and decade digits;
  • century categories: provide the century digit.

Examples:

1985 (year):
{{births by year
 |century = 19
 |decade  = 8
 |year    = 5
}}

1980s (decade):
{{births by year
 |century = 19
 |decade  = 8
 |year    = 
}}

20th century:
{{births by year
 |century = 19
 |decade  = 
 |year    = 
}}

50:
{{births by year
 |century =
 |decade  = 5
 |year    = 0
}}

1250s BCE (decade):

{{births by year
 |century = 12
 |decade  = 5
 |year    =
 |era     = BCE
}}

1st century

Two slight changes are needed for the first century and first decade categories, because the digits normally given to the template aren't there (for example, there is no decade digit for year 5).

Decade one (years 1–9):
{{births by year
 |century = 
 |decade  = 0
 |year    = 
}}

First century category:
{{births by year
 |century = 
 |decade  = 
 |year    = 
}}

For coders

Note:
This template is not intended to be used directly by editors; if you are looking for documentation on a template like {{births by year}}, see For editors above. Currently, the following templates use this system:

Usage

This template is used as part of specific templates like {{deaths by year}} to generate lists of dated categories (century, decades, years). It deduces the depth from how much information is provided. The code below is standard (change values as appropriate):

{{categories by date
 |century = {{{century}}}
 |decade  = {{{decade}}}
 |year    = {{{year}}}
 |caption = Authors who died
 |name    = deaths
 |parentcat = Authors by date
 |era     = {{#switch:{{{era|}}}|BCE|BC=BCE}}
}}
  • century, decade, year: The date split into century, decade, and year digits.
  • caption: The text used as part of the category description (for example, "{caption} in the year 1986").
  • name: The text used in the categories (for example, [[Category:1986 {name}]]).
  • parentcat: The parent category that contains the current dated categories system.
  • era: toggles whether to add "BCE" to the category names.

Nested template

This template makes use of the nested template {{template:categories by date/list}} to generate lists of categories. This nested templates manipulates parameters in such a way as to minimize computation:

  • 1 (prefix digits): the digits of the year, excepting the last number.
  • 2 (suffix): text to add after the date; for example, s in 1980s works.
  • 3 (category label): the text in the category names; for example, works in 1980 works.
  • 4 (era): BCE if in that era.
Purpose Code Output
Common era
list years {{categories by date/list|198||deaths}} 1980198119821983198419851986198719881989
list decades {{categories by date/list|19|0s|deaths}} 1900s1910s1920s1930s1940s1950s1960s1970s1980s1990s
Before common era
list years {{categories by date/list|50||deaths|BCE}} 500501502503504505506507508509
list decades {{categories by date/list|5|0s|deaths|BCE}} 500s510s520s530s540s550s560s570s580s590s

See also