Difference between revisions of "Template:NameSorter"

From ChoralWiki
Jump to navigation Jump to search
(using LastNameFirst)
(updated doc)
 
Line 1: Line 1:
 
<includeonly>{{StripAccents|{{LastNameFirst|{{{1|{{PAGENAME}} }}} }} }}</includeonly><noinclude><!--
 
<includeonly>{{StripAccents|{{LastNameFirst|{{{1|{{PAGENAME}} }}} }} }}</includeonly><noinclude><!--
-->{{DisplayBox|bgcolor=g|text=
+
-->{{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.
 
Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)", removing all diacritics in the process.
  
 
'''Syntax:'''
 
'''Syntax:'''
* <tt><nowiki>{{NameSorter}}</nowiki></tt> returns the contents of <tt><nowiki>{{PAGENAME}}</nowiki></tt> after processing it.
+
* {{tl|NameSorter}} returns the contents of <tt><nowiki>{{PAGENAME}}</nowiki></tt> after processing it.
  
 
'''Syntax with an optional parameter:'''
 
'''Syntax with an optional parameter:'''
* <tt><nowiki>{{NameSorter|Antonín Dvořák}}</nowiki></tt> returns "{{NameSorter|Antonín Dvořák}}"
+
* {{tl|NameSorter|Antonín Dvořák}} 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 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>
 
* <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 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>
 
* <tt><nowiki>{{DEFAULTSORT:La Rue, Pierre de}}</nowiki></tt>
 +
 +
===See also===
 +
*[[Template:LastNameFirst]]
 +
*[[Template:StripAccents]]
 
}}
 
}}
 
[[Category:Text formatting templates]]
 
[[Category:Text formatting templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 12:58, 20 May 2013

Documentation

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

See also