ਫਰਮਾ:Categories by date/list
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}}
|
1980–1981–1982–1983–1984–1985–1986–1987–1988–1989 |
list decades | {{categories by date/list|19|0s|deaths}}
|
1900s–1910s–1920s–1930s–1940s–1950s–1960s–1970s–1980s–1990s |
Before common era | ||
list years | {{categories by date/list|50||deaths|BCE}}
|
500–501–502–503–504–505–506–507–508–509 |
list decades | {{categories by date/list|5|0s|deaths|BCE}}
|
500s–510s–520s–530s–540s–550s–560s–570s–580s–590s |
See also
[ਸੋਧੋ]- Template:Categories by date (underlying template)
- Template:Births by year
- Template:Deaths by year
- Template:Works by year