Template:NameSorter: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
m (moved Template:LastName to Template:NameSorter: following a suggestion by Chuck to avoid confusion with the "last name" itself)
m (fix name)
Line 7: Line 7:


'''Syntax:'''
'''Syntax:'''
* <tt><nowiki>{{LastName}}</nowiki></tt> returns the contents of <tt><nowiki>{{PAGENAME}}</nowiki></tt> after processing it.
* <tt><nowiki>{{NameSorter}}</nowiki></tt> returns the contents of <tt><nowiki>{{PAGENAME}}</nowiki></tt> after processing it.


'''Syntax with an optional parameter:'''
'''Syntax with an optional parameter:'''
* <tt><nowiki>{{LastName|Antonín Dvořák}}</nowiki></tt> returns "{{LastName|Antonín Dvořák}}"
* <tt><nowiki>{{NameSorter|Antonín Dvořák}}</nowiki></tt> returns "{{NameSorter|Antonín Dvořák}}"




This template is meant to be used in conjunction with the magic word <tt><nowiki>DEFAULTSORT</nowiki></tt> inside Composer and User pages, delivering to it an appropriate sort key.
This template is meant to be used in conjunction with the magic word <tt><nowiki>DEFAULTSORT</nowiki></tt> inside Composer and User pages, delivering to it an appropriate sort key.


* <tt><nowiki>{{DEFAULTSORT:{{LastName}}}}</nowiki></tt>
* <tt><nowiki>{{DEFAULTSORT:{{NameSorter}}}}</nowiki></tt>


In the cases in which the template returns an invalid sort key, as for example "Rue, Pierre de la", use a textual key instead:
In the cases in which the template returns an invalid sort key, as for example "Rue, Pierre de la", use a textual key instead:

Revision as of 14:14, 3 August 2009

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}}