Template:LastNameFirst: Difference between revisions
Jump to navigation
Jump to search
(adding exception for chants) |
m (sort key test) |
||
Line 1: | Line 1: | ||
<includeonly>{{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}} |{{#explode:{{{1|{{PAGENAME}}}}}||0}} | <includeonly>{{#switch: {{{1|{{PAGENAME}}}}} | ||
|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 | |||
|#default = {{#switch: {{#explode:{{{1|{{PAGENAME}}}}}||-1}} | |||
|{{#explode:{{{1|{{PAGENAME}}}}}||0}} | |||
|chant = {{ucfirst:{{{1|{{PAGENAME}}}}} }} | |chant = {{ucfirst:{{{1|{{PAGENAME}}}}} }} | ||
|{{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= | -->{{DisplayBox|bgcolor=g|text= | ||
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)". |
Revision as of 04:35, 29 April 2015
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)