Difference between revisions of "Template:NameSorter"
Jump to navigation
Jump to search
Documentation
(added function StripAccents) |
(updated doc) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | <includeonly>{{StripAccents|{{LastNameFirst|{{{1|{{PAGENAME}} }}} }} }}</includeonly><noinclude><!-- |
− | + | -->{{DisplayBox|title=Documentation|text= | |
− | + | Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)", removing all diacritics in the process. | |
− | |||
− | + | '''Syntax:''' | |
+ | * {{tl|NameSorter}} returns the contents of <tt><nowiki>{{PAGENAME}}</nowiki></tt> after processing it. | ||
+ | |||
+ | '''Syntax with an optional parameter:''' | ||
+ | * {{tl|NameSorter|Antonín Dvořák}} returns "{{NameSorter|Antonín Dvořák}}" | ||
+ | |||
+ | |||
+ | This template is meant to be used as a parameter for the magic word <tt><nowiki>DEFAULTSORT</nowiki></tt> inside Composer and Editor pages, producing an appropriate sort key. | ||
+ | |||
+ | * <tt><nowiki>{{DEFAULTSORT:{{NameSorter}}}}</nowiki></tt> | ||
+ | |||
+ | In the situations where the normal usage of this template would render an incorrect sort key (as for example "Rue, Pierre de la"), use a textual key instead: | ||
+ | |||
+ | * <tt><nowiki>{{DEFAULTSORT:La Rue, Pierre de}}</nowiki></tt> | ||
+ | |||
+ | ===See also=== | ||
+ | *[[Template:LastNameFirst]] | ||
+ | *[[Template:StripAccents]] | ||
+ | }} | ||
+ | [[Category:Text formatting templates]] | ||
</noinclude> | </noinclude> |
Latest revision as of 12:58, 20 May 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 as a parameter for the magic word DEFAULTSORT inside Composer and Editor pages, producing an appropriate sort key.
- {{DEFAULTSORT:{{NameSorter}}}}
In the situations where the normal usage of this template would render an incorrect sort key (as for example "Rue, Pierre de la"), use a textual key instead:
- {{DEFAULTSORT:La Rue, Pierre de}}