Template:LastNameFirst: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(expanded doc)
mNo edit summary
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
|Pierre de la Rue
|Pierre de la Rue
|Pierre de La Rue = La Rue, Pierre de
|Pierre de La Rue = La Rue, Pierre de
|Josquin des Prés
|Josquin des Prez
|Josquin Des Prez = Josquin Des Prez
<!-- END OF EXCEPTIONS LIST --><noinclude></poem></noinclude><includeonly>
<!-- END OF EXCEPTIONS LIST --><noinclude></poem></noinclude><includeonly>
|#default = {{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}}
|#default = {{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}}
Line 23: Line 26:


: {{tl|LastNameFirst|Gregorian chant}}
: {{tl|LastNameFirst|Gregorian chant}}
returns "{{LastNameFirst|Gregorian chant}}" (note that chant names are not inverted)
returns "{{LastNameFirst|Gregorian chant}}" (chant names are not inverted)


: {{tl|LastNameFirst|José Maurício Nunes Garcia}}
: {{tl|LastNameFirst|José Maurício Nunes Garcia}}
returns "{{LastNameFirst|José Maurício Nunes Garcia}}" (it is one of the names on the Exceptions list)
returns "{{LastNameFirst|José Maurício Nunes Garcia}}" (it is one of the names on the Exceptions list)
;Usage by other templates
LastNameFirst is used inside template {{CT|NameSorter}}, which generates sort keys. NameSorter does remove diacritics:
: {{tl|NameSorter|José Maurício Nunes Garcia}}
returns "{{NameSorter|José Maurício Nunes Garcia}}"
}}
}}
[[Category:Text formatting templates]]
[[Category:Text formatting templates]]
</noinclude>
</noinclude>

Revision as of 03:18, 28 May 2018

Exceptions list:


|Jose Mauricio Nunes Garcia
|José Maurício Nunes Garcia = Nunes Garcia, José Maurício
|Pierre de la Rue
|Pierre de La Rue = La Rue, Pierre de
|Josquin des Prés
|Josquin des Prez
|Josquin Des Prez = Josquin Des Prez

Documentation

Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)".

Syntax:

{{LastNameFirst}}

returns the contents of {{PAGENAME}} after processing it.

Syntax with an optional parameter:

{{LastNameFirst|Antonín Dvořák}}

returns "Dvořák, Antonín" (note that diacritics are not removed)

{{LastNameFirst|Gregorian chant}}

returns "Gregorian chant" (chant names are not inverted)

{{LastNameFirst|José Maurício Nunes Garcia}}

returns "Nunes Garcia, José Maurício" (it is one of the names on the Exceptions list)

Usage by other templates

LastNameFirst is used inside template NameSorter, which generates sort keys. NameSorter does remove diacritics:

{{NameSorter|José Maurício Nunes Garcia}}

returns "Nunes Garcia, Jose Mauricio "