Template:NameSorter: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(added documentation)
(+ a counterexample)
Line 13: Line 13:




This template is meant to be used in conjunction with the magic word <tt><nowiki>DEFAULTSORT</nowiki></tt> in 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.


'''Example:'''
* <tt><nowiki>{{DEFAULTSORT:{{LastName}}}}</nowiki></tt>
* <tt><nowiki>{{DEFAULTSORT:{{LastName}}}}</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:
* <tt><nowiki>{{DEFAULTSORT:La Rue, Pierre de}}</nowiki></tt>
}}
}}
[[Category:Templates|{{PAGENAME}}]]
[[Category:Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Revision as of 05:27, 16 May 2009

Converts a text in the form "Name(s) Surname" to the form "Surname, Name(s)", removing all diacritics in the process.

Syntax:

  • {{LastName}} returns the contents of {{PAGENAME}} after processing it.

Syntax with an optional parameter:


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:{{LastName}}}}

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