Template:Lifetime

From Wikipedia, the free encyclopedia
Jump to: navigation, search


{{DEFAULTSORT:{{{3}}}}}
[[Category:{{{1}}} births]]
[[Category:{{{2}}} deaths]]

Documentation icon Template documentation[view] [edit] [history] [purge]

{{Lifetime}} is a shortcut to generate birth and death categories and DEFAULTSORT. Automatic bots regularly replace it with the expanded form, but editors can still use lifetime to save on typing.

A less typing alternative: the subst: only {{L}} can be used as {{subst:l|1901|1983|Bloggs, Fred}}, adding the expanded form directly to the article.

This template can be substituted.

Usage[edit]

{{Lifetime}} is for quickly generating category tags related to birth and death years, including living people and missing or unknown values. The general DEFAULTSORT can be embedded as well. It should not be used to replace existing DEFAULTSORT and/or category tags.

{{Lifetime|year of birth|year of death|sort key}}

or

{{Subst:L|year of birth|year of death|sort key}}

will generate:

{{DEFAULTSORT:sort key}}
[[Category:BIRTH births]]
[[Category:DEATH deaths]]

Other cases are handled with options. The embedded magic word DEFAULTSORT applies to all categories on the page, no matter whether the lifetime template is before or after them.

This template supports substitution. If you want to substitute it, use the following syntax:

{{subst:Lifetime|year of birth|year of death|sort key}}

or

{{subst:L|year of birth|year of death|sort key}}

Since the {{DEFAULTSORT:}} should occur before the categories, the Lifetime template should generally be placed before the first Category tag, for example:

{{Lifetime|year of birth|year of death|sort key}}
[[Category:ABC]]
:
[[Category:XYZ]]

Options[edit]

For each option, the default value is displayed in bold and automatically assumed if the field is left blank.

Please note that MISSING results in Categories that are not displayed on the page.

1 (birth)
2 (death)
3 (sortkey)
  • {{PAGENAME}} : should not be left blank even if it is the same as the page name - only if you don't know what it should be.
  • Asian name, Honorific prefix (qualifier suffix) : for assertion of sortkey assessment.
    "Mao, Zedong" - "Kim, Il-sung" - "Matsuo Bashō|Matsuo, Basho" - "Nu, U" - "Wang, Li (politician)"
  • Family name, Given name, Honorific-prefix (qualifier suffix) : for proper sorting.
    "Newton, Isaac, Sir" - "Karlsson, Ove (sports journalist)"
  • For further details, see Wikipedia:Categorization of people#Ordering names in a category.

Most values are case-insensitive ("LIVING" or "LiVinG" work the same), except when it matters (such as century names).

Examples[edit]

For a living person
{{Lifetime|1899||Surname, Name}}

or

{{Lifetime|1899|LIVING|Surname, Name}}

will replace:

{{DEFAULTSORT:Surname, Name}}
[[Category:1899 births]]
[[Category:Living people]]
For a missing birth and living person
{{Lifetime|||Surname, Name}}

or

{{Lifetime|MISSING|LIVING|Surname, Name}}

will replace:

{{DEFAULTSORT:Surname, Name}}
[[Category:Year of birth missing (living people)]]
[[Category:Living people]]
For a dead person
{{Lifetime|1899|1986|Surname, Name}}

will replace:

{{DEFAULTSORT:Surname, Name}}
[[Category:1899 births]]
[[Category:1986 deaths]]
Etc.

Technical[edit]

Before changing the template's code or text, please bear in mind:

  • The extra bars in the switch statements are for empty values.
  • Extra whitespace around years doesn't matter, because page titles are not sensitive to extra spaces.

The template provides a local sandbox and testcases for developing and testing changes (see documentation's hat-note).

See also[edit]