Difference between revisions of "Template:LastNameFirst"

From ChoralWiki
Jump to navigation Jump to search
m (sort key test)
(expanded doc)
Line 1: Line 1:
<includeonly>{{#switch: {{{1|{{PAGENAME}}}}}
+
<includeonly>{{#switch: {{{1|{{PAGENAME}}}}}</includeonly>
 +
<!-- ADD HERE EXCEPTIONS TO THE RULE, IN ALPHABETICAL ORDER --><noinclude>'''Exceptions list:'''<poem></noinclude>
 
|Jose Mauricio Nunes Garcia
 
|Jose Mauricio Nunes Garcia
 
|José Maurício Nunes Garcia = Nunes Garcia, José Maurício
 
|José Maurício Nunes Garcia = Nunes Garcia, José Maurício
 
|Pierre de la Rue
 
|Pierre de la Rue
 
|Pierre de La Rue = La Rue, Pierre de
 
|Pierre de La Rue = La Rue, Pierre de
 +
<!-- END OF EXCEPTIONS LIST --><noinclude></poem></noinclude><includeonly>
 
|#default = {{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}}
 
|#default = {{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}}
 
|{{#explode:{{{1|{{PAGENAME}}}}}||0}}
 
|{{#explode:{{{1|{{PAGENAME}}}}}||0}}
Line 9: Line 11:
 
|{{ucfirst:{{#explode:{{{1|{{PAGENAME}}}}}||-1}}, {{#sub:{{{1|{{PAGENAME}}}}}||{{#expr:{{#len:{{{1|{{PAGENAME}}}}}}} - {{#len:{{#explode:{{{1|{{PAGENAME}}}}}||-1}}}} }} }} }}
 
|{{ucfirst:{{#explode:{{{1|{{PAGENAME}}}}}||-1}}, {{#sub:{{{1|{{PAGENAME}}}}}||{{#expr:{{#len:{{{1|{{PAGENAME}}}}}}} - {{#len:{{#explode:{{{1|{{PAGENAME}}}}}||-1}}}} }} }} }}
 
}} }}</includeonly><noinclude><!--
 
}} }}</includeonly><noinclude><!--
-->{{DisplayBox|bgcolor=g|text=
+
-->{{Doc|1=
 
Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)".
 
Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)".
  
Line 18: Line 20:
 
'''Syntax with an optional parameter:'''
 
'''Syntax with an optional parameter:'''
 
: {{tl|LastNameFirst|Antonín Dvořák}}
 
: {{tl|LastNameFirst|Antonín Dvořák}}
returns "{{LastNameFirst|Antonín Dvořák}}" (note that diacritics are not removed)  
+
returns "{{LastNameFirst|Antonín Dvořák}}" (note that diacritics are not removed)
  
 
: {{tl|LastNameFirst|Gregorian chant}}
 
: {{tl|LastNameFirst|Gregorian chant}}
returns "{{LastNameFirst|Gregorian chant}}" (note that chant names are not inverted)  
+
returns "{{LastNameFirst|Gregorian chant}}" (note that chant names are not inverted)
 +
 
 +
: {{tl|LastNameFirst|José Maurício Nunes Garcia}}
 +
returns "{{LastNameFirst|José Maurício Nunes Garcia}}" (it is one of the names on the Exceptions list)
 
}}
 
}}
 
[[Category:Text formatting templates]]
 
[[Category:Text formatting templates]]
 
</noinclude>
 
</noinclude>

Revision as of 18:35, 29 April 2015

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

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" (note that 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)