Difference between revisions of "Template:Lifetime/doc"

From blackwiki
Jump to navigation Jump to search
imported>Nyuszika7H
imported>Andy M. Wang
Line 1: Line 1:
{{Documentation subpage}}
+
#REDIRECT [[Template:L/doc]]
<!--
 
    PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE
 
-->
 
{{TOCright}}
 
 
 
'''<code><nowiki>{{</nowiki>Lifetime}}</code>''' 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 [[Template:l|<nowiki>{{L}}</nowiki>]] can be used as <nowiki>{{subst:l|1901|1983|Bloggs, Fred}}</nowiki>, adding the expanded form directly to the article.
 
 
 
This template can be substituted.
 
 
 
==Usage==
 
'''<code><nowiki>{{</nowiki>Lifetime}}</code>''' 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.
 
 
 
: <code><nowiki>{{</nowiki>Lifetime|''year of birth''|''year of death''|''sort key''}}</code>
 
or
 
: <code><nowiki>{{</nowiki>Subst:L|''year of birth''|''year of death''|''sort key''}}</code>
 
 
 
will generate:
 
 
 
: <code><nowiki>{{</nowiki>DEFAULTSORT:''sort key''}}</code>
 
: <code><nowiki>[[</nowiki>Category:''BIRTH'' births]]</code>
 
: <code><nowiki>[[</nowiki>Category:''DEATH'' deaths]]</code>
 
 
 
Other cases are handled with options. The embedded [[Help:Magic words|magic word]] DEFAULTSORT applies to all categories on the page, no matter whether the lifetime template is before or after them.
 
 
 
This template supports [[Help:Substitution|substitution]]. If you want to substitute it, use the following syntax:
 
 
 
: <code><nowiki>{{</nowiki>'''subst:'''Lifetime|''year of birth''|''year of death''|''sort key''}}</code>
 
or
 
: <code><nowiki>{{</nowiki>'''subst:'''L|''year of birth''|''year of death''|''sort key''}}</code>
 
 
 
Since the <code><nowiki>{{DEFAULTSORT:}}</nowiki></code> should occur [[WP:FOOTERS|before the categories]], the Lifetime template should generally be placed before the first Category tag, for example:
 
 
 
: <code><nowiki>{{</nowiki>Lifetime|''year of birth''|''year of death''|''sort key''}}</code>
 
: <code><nowiki>[[</nowiki>Category:ABC]]</code>
 
:: <nowiki>:</nowiki>
 
: <code><nowiki>[[</nowiki>Category:XYZ]]</code>
 
 
 
==Options==
 
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)
 
:* '''MISSING''' : when year seems possible to be found.
 
:*: [[:Category:Year of birth missing]] or [[:Category:Year of birth missing (living people)]]
 
:* ''year of birth'' : such as "1899" or known approximations such as "1890s" or "19th-century" (note the hyphen).
 
:*: [[:Category:1899 births]] or [[:Category:1890s births]] or [[:Category:19th-century births]]
 
 
 
; 2 (death)
 
:* '''LIVING''' : living or assumed living people.
 
:*: [[:Category:Living people]]
 
:* MISSING : believed dead and year seems possible to be found.
 
:*: [[:Category:Year of death missing]]
 
:* ''year of death'' : such as "1986" or known approximations such as  "1980s" or "20th-century" (note the hyphen).
 
:*: [[:Category:1986 deaths]] or [[:Category:1980s deaths]] or [[:Category:20th-century deaths]]
 
 
 
; 3 (sortkey)
 
:* '''<nowiki>{{</nowiki>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" - "[[U Nu|Nu, U]]" - "[[Wang Li (politician)|Wang, Li]] (politician)"
 
:* ''Family name, Given name, Honorific-prefix (qualifier suffix)'' : for proper sorting.
 
:*: "Newton, Isaac, Sir" - "[[Ove Karlsson (sports journalist)|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==
 
; For a living person
 
: <code><nowiki>{{</nowiki>Lifetime|1899||Surname, Name}}</code>
 
or
 
: <code><nowiki>{{</nowiki>Lifetime|1899|LIVING|Surname, Name}}</code>
 
will replace:
 
: <code><nowiki>{{DEFAULTSORT:Surname, Name}}</nowiki></code>
 
: <code><nowiki>[[Category:1899 births]]</nowiki></code>
 
: <code><nowiki>[[Category:Living people]]</nowiki></code>
 
 
 
; For a missing birth and living person
 
: <code><nowiki>{{</nowiki>Lifetime|||Surname, Name}}</code>
 
or
 
: <code><nowiki>{{</nowiki>Lifetime|MISSING|LIVING|Surname, Name}}</code>
 
will replace:
 
: <code><nowiki>{{DEFAULTSORT:Surname, Name}}</nowiki></code>
 
: <code><nowiki>[[Category:Year of birth missing (living people)]]</nowiki></code>
 
: <code><nowiki>[[Category:Living people]]</nowiki></code>
 
 
 
; For a dead person
 
: <code><nowiki>{{</nowiki>Lifetime|1899|1986|Surname, Name}}</code>
 
will replace:
 
: <code><nowiki>{{DEFAULTSORT:Surname, Name}}</nowiki></code>
 
: <code><nowiki>[[Category:1899 births]]</nowiki></code>
 
: <code><nowiki>[[Category:1986 deaths]]</nowiki></code>
 
 
 
; Etc.
 
 
 
==Technical==
 
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==
 
* [[Template:L]]
 
* [[Help:Category#Default sort key]], about categories and DEFAULTSORT
 
* [[Help:Magic words#Parser functions]], about DEFAULTSORT technically
 
 
 
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
 
 
[[Category:Sorting templates|{{PAGENAME}}]]
 
[[Category:Typing-aid templates|{{PAGENAME}}]]
 
[[Category:Wikipedia templates to be automatically substituted]]
 
 
 
</includeonly>
 

Revision as of 08:37, 23 May 2016

Redirect to: