Template:NameSorter: Difference between revisions
Jump to navigation
Jump to search
(ucfirst: to guarantee that the first letter is uppercase) |
(using LastNameFirst) |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly>{{StripAccents|{{LastNameFirst|{{{1|{{PAGENAME}} }}} }} }}</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)", removing all diacritics in the process. | Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)", removing all diacritics in the process. | ||
Line 21: | Line 18: | ||
* <tt><nowiki>{{DEFAULTSORT:La Rue, Pierre de}}</nowiki></tt> | * <tt><nowiki>{{DEFAULTSORT:La Rue, Pierre de}}</nowiki></tt> | ||
}} | }} | ||
[[Category: | [[Category:Text formatting templates]] | ||
</noinclude> | </noinclude> |
Revision as of 05:20, 10 March 2013
Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)", removing all diacritics in the process.
Syntax:
- {{NameSorter}} returns the contents of {{PAGENAME}} after processing it.
Syntax with an optional parameter:
- {{NameSorter|Antonín Dvořák}} returns "Dvorak, Antonin "
This template is meant to be used in conjunction with the magic word DEFAULTSORT inside Composer and User pages, delivering to it an appropriate sort key.
- {{DEFAULTSORT:{{NameSorter}}}}
In the cases in which the template returns an invalid sort key, as for example "Rue, Pierre de la", use a textual key instead:
- {{DEFAULTSORT:La Rue, Pierre de}}