Difference between revisions of "Template:Lifetime/doc"

From blackwiki
Jump to navigation Jump to search
imported>Gene Nygaard
(→‎Options: the conventional quasi-field separator between family name and given name is both a comma and a space and needs to be included)
imported>EmausBot
m (Bot: Fixing double redirect to Template:Person categories/doc)
 
(93 intermediate revisions by 55 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
+
#REDIRECT [[Template:Person categories/doc]]
<!--
 
    PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE
 
-->
 
{{Template shortcut|BORN-DIED-SORT|<!--"BD" TOO AMBIGUOUS-->BD-SORT}}
 
{{TOCright}}
 
==Usage==
 
 
 
'''<CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}}}</CODE>''' 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.
 
 
 
: <CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}|''year of birth''|''year of death''|''sort key''}}</CODE>
 
 
 
will replace:
 
 
 
: <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, see below. As with the original, the embedded [[Help:Magic words|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)
 
:* '''MISSING''' : when year seems possible to be found.
 
:*: [[:Category:Year of birth missing]] or [[:Category:Year of birth missing (living people)]]
 
:* UNKNOWN : when year seems unlikely to be found (pre-19th century).
 
:*: [[:Category:Year of birth unknown]]
 
:* ''year of birth'' : such as "1899" or "1890s" or "19th century" (known approximations).
 
:*: [[: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]]
 
:* UNKNOWN : when year seems unlikely to be found (pre-19th century).
 
:*: [[:Category:Year of death unknown]]
 
:* ''year of death'' : such as "1986" or "1980s" or "20th century" (known approximations).
 
:*: [[:Category:1986 deaths]] or [[:Category:1980s deaths]] or [[:Category:20th century deaths]]
 
 
 
; 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).
 
:* ''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.
 
:*: "Newton, Isaac, Sir" - "[[Ove Karlsson|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
 
: <CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}|1899||Surname, Name}}</CODE>
 
or
 
: <CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}|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>{{BASEPAGENAME}}|||Surname, Name}}</CODE>
 
or
 
: <CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}|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>{{BASEPAGENAME}}|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>
 
 
 
; For an ancient birth not recorded by history
 
: <CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}|UNKNOWN|12th century|Surname, Name}}</CODE>
 
will replace:
 
: <CODE><NOWIKI>{{DEFAULTSORT:Surname, Name}}</NOWIKI></CODE>
 
: <CODE><NOWIKI>[[Category:Year of birth unknown]]</NOWIKI></CODE>
 
: <CODE><NOWIKI>[[Category:12th century deaths]]</NOWIKI></CODE>
 
 
 
; 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 <CODE><NOWIKI>"{{{1}}}"</NOWIKI></CODE>) and double switch values (such as <CODE>"MISSING"|""</CODE>) instead of just <CODE><NOWIKI>{{{1|MISSING}}}</NOWIKI></CODE> is required to handle defined-but-empty parameters that disable default values with calls such as {{nowrap|<CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}<NOWIKI>||1986|Sortkey}}</NOWIKI></CODE>}} (in this case, <CODE><NOWIKI>{{{1}}}</NOWIKI></CODE> 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 {{nowrap|<CODE><NOWIKI>{{</NOWIKI>{{BASEPAGENAME}}<NOWIKI>| 1899 |}}</NOWIKI></CODE>}} will 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==
 
 
 
* [[Help:Category]], about categories and DEFAULTSORT
 
* [[Help:Magic words]], about DEFAULTSORT technically
 
 
 
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
 
 
[[Category:Uncategorized templates]]
 
<!--
 
NOT FOUND AN EQUIVALENT FOR
 
http://simple.wikipedia.org/wiki/Category:Category_templates
 
-->
 
[[Category:Sorting templates]]
 
[[Category:Templates using ParserFunctions]]
 
 
 
[[Simple:Template:BD]]
 
 
 
</includeonly>
 

Latest revision as of 20:52, 28 October 2020