Predloga:Lifetime/dok
To je dokumentacijska podstran za glavno stran Predloga:Lifetime. Namenjena je shranjevanju navodil, kategorizaciji in drugi vsebini, ki ni del glavne strani. |
Usage
[uredi kodo]{{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.
This template supports optional substitution. If you want to substitute it, use the following syntax:
{{subst:Lifetime|year of birth|year of death|sort key|subst=subst:}}
Since Categories are preferred to be listed in most-common order, the Lifetime template should generally be placed after the last Category tag, for example:
[[Category:ABC]]
- :
[[Category:XYZ]]
{{Lifetime|year of birth|year of death|sort key}}
Options
[uredi kodo]For each option, the default value is displayed in bold and automatically assumed if the field is left blank.
- 1 (birth)
-
- MISSING : when year seems possible to be found.
- UNKNOWN : when year seems unlikely to be found (pre-19th century).
- year of birth : such as "1899" or "1890s" or "19th century" (known approximations).
- 2 (death)
-
- LIVING : living or assumed living people.
- MISSING : believed dead and year seems possible to be found.
- UNKNOWN : when year seems unlikely to be found (pre-19th century).
- year of death : such as "1986" or "1980s" or "20th century" (known approximations).
- 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.
- 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
[uredi kodo]- For a living person
{{Lifetime|1899||Surname, Name}}
or
{{Lifetime|1899|LIVING|Surname, Name}}
will replace:
{{DEFAULTSORT:Surname, Name}}
[[Kategorija:1899 births]]
[[Kategorija:Living people]]
- For a missing birth and living person
{{Lifetime|||Surname, Name}}
or
{{Lifetime|MISSING|LIVING|Surname, Name}}
will replace:
{{DEFAULTSORT:Surname, Name}}
[[Kategorija:Year of birth missing (living people)]]
[[Kategorija:Living people]]
- For a dead person
{{Lifetime|1899|1986|Surname, Name}}
will replace:
{{DEFAULTSORT:Surname, Name}}
[[Kategorija:1899 births]]
[[Kategorija:1986 deaths]]
- For an ancient birth not recorded by history
{{Lifetime|UNKNOWN|12th century|Surname, Name}}
will replace:
{{DEFAULTSORT:Surname, Name}}
[[Kategorija:Year of birth unknown]]
[[Kategorija:12th century deaths]]
- Etc.
Technical
[uredi kodo]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 seemingingly useless extra bars in the switch statements are for empty values.
- Extra whitespace around years doesn't matter, because MediaWiki strips whitespace from each end of template parameters. Calls such as
{{Lifetime| 1899 |}}
will, therefore, still work with Category:1899 births despite the extra whitespace.
The template provides a local sandbox and testcases for developing and testing changes (see documentation's hatnote).
See also
[uredi kodo]- Help:Category#Default sort key, about categories and DEFAULTSORT
- Help:Magic words#Parser functions, about DEFAULTSORT technically