Difference between revisions of "Template:Lifetime/doc"

From blackwiki
Jump to navigation Jump to search
imported>Komusou
(→‎Usage: tweak)
imported>Komusou
(→‎Options: tweak and examples)
Line 21: Line 21:
 
==Options==
 
==Options==
  
(For each option, the default value is displayed in bold.)
+
For each option, the '''default value''' is displayed in bold and automatically assumed if the field is left blank.
  
 
; 1 (birth)
 
; 1 (birth)
Line 32: Line 32:
  
 
; 2 (death)
 
; 2 (death)
:* '''LIVING''' : assumed living people.
+
:* '''LIVING''' : living or assumed living people.
 
:*: [[:Category:Living people]]
 
:*: [[:Category:Living people]]
 
:* MISSING : believed dead and year seems possible to be found.
 
:* MISSING : believed dead and year seems possible to be found.
Line 43: Line 43:
 
; 3 (sortkey)
 
; 3 (sortkey)
 
:* '''<NOWIKI>{{</NOWIKI>PAGENAME}}''' : should usually never be left blank (especially with Asian names, it is hard to make the difference between a missing sortkey and a sortkey identical to the article name due to a family-first name).
 
:* '''<NOWIKI>{{</NOWIKI>PAGENAME}}''' : should usually never be left blank (especially with Asian names, it is hard to make the difference between a missing sortkey and a sortkey identical to the article name due to a family-first name).
:* ''Article name'' : for explicit assertion of sortkey assessment.
+
:* ''Asian name, Honorific prefix (qualifier suffix)'' : for assertion of sortkey assessment.
 +
:*: "Mao Zedong" - "Kim Il-sung" - "Matsuo Basho" - "[[U Nu|Nu, U]]" - "[[Wang Li]] (politician)"
 
:* ''Family name, Given name, Honorific-prefix (qualifier suffix)'' : for proper sorting.
 
:* ''Family name, Given name, Honorific-prefix (qualifier suffix)'' : for proper sorting.
 +
:*: "Newton, Isaac, Sir" - "[[Ove Karlsson|Karlsson, Ove]] (sports journalist)"
  
(Most values are case-insensitive, except when it matters, such as centuries.)
+
Most values are case-insensitive ("LIVING" or "LiVinG" work the same), except when it matters (such as century names).
  
 
==Examples==
 
==Examples==

Revision as of 16:38, 26 November 2007

Template:TOCright

Usage

{{Lifetime}} is for automatically generating all category tags related to birth and death years, including living people and missing or unknown values. The general DEFAULTSORT can be embedded as well.

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

will replace:

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

Other cases are handled with options, see below. As with the original, the embedded magic word DEFAULTSORT also applies to all categories listed below the template.

Options

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

1 (birth)
2 (death)
3 (sortkey)
  • {{PAGENAME}} : should usually never be left blank (especially with Asian names, it is hard to make the difference between a missing sortkey and a sortkey identical to the article name due to a family-first name).
  • Asian name, Honorific prefix (qualifier suffix) : for assertion of sortkey assessment.
    "Mao Zedong" - "Kim Il-sung" - "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)"

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

Examples

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]]
For an ancient birth not recorded by history
{{Lifetime|UNKNOWN|12th century|Surname, Name}}

will replace:

{{DEFAULTSORT:Surname, Name}}
[[Category:Year of birth unknown]]
[[Category:12th century deaths]]
Etc.

Technical

Before changing the template's code or text, please bear in mind some points that should be preserved:

  • The template's name and its aliases are in all-caps and feature the suffix -SORT so as to clue in editors that it embeds and replaces DEFAULTSORT. (The original alias "BD" was renamed and is unlisted for the same reason.)
  • The use of quotation marks around tested parameters (such as "{{{1}}}") and double switch values (such as "MISSING"|"") instead of just {{{1|MISSING}}} is required to handle defined-but-empty parameters that disable default values with calls such as {{Lifetime||1986|Sortkey}} (in this case, {{{1}}} is empty but defined, its default value wouldn't be triggered, and a #if would be considered true despite its actual emptiness, so we explicitely check against an empty value surrounded by quotes).
  • Extra whitespace around years could be trimmed but isn't, because category links work identically even with two spaces between words, so calls such as {{Lifetime| 1899 |}} will still work with Category:1899 births despite the extra whitespace.

See also