Template:WorkSorter: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(a second switch for L' and Un')
m (PAGENAME returns a few characters encoded)
Line 6: Line 6:
|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100
|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100
|the|das|die|der|den|dem|la|le|lo|il|a|as|o|os = {{ucfirst: {{#sub:{{{1|{{PAGENAME}}}}}|{{#pos:{{{1|{{PAGENAME}}}}}|{{#explode:{{{1|{{PAGENAME}}}}}||1}} }} }} }}
|the|das|die|der|den|dem|la|le|lo|il|a|as|o|os = {{ucfirst: {{#sub:{{{1|{{PAGENAME}}}}}|{{#pos:{{{1|{{PAGENAME}}}}}|{{#explode:{{{1|{{PAGENAME}}}}}||1}} }} }} }}
|#default = {{#switch: {{lc:{{#explode:{{{1|{{PAGENAME}}}}}|'|0}} }}
|#default = {{#switch: {{lc:{{#explode:{{{1|{{PAGENAME}}}}}|'|0}} }}
|l|un = {{ucfirst: {{#sub:{{{1|{{PAGENAME}}}}}|{{#pos:{{{1|{{PAGENAME}}}}}|{{#explode:{{{1|{{PAGENAME}}}}}|'|1}} }} }} }}
|l|un = {{ucfirst: {{#sub:{{{1|{{PAGENAME}}}}}|{{#pos:{{{1|{{PAGENAME}}}}}|{{#explode:{{{1|{{PAGENAME}}}}}|'|1}} }} }} }}
|#default = {{{1|{{PAGENAME}}}}}
|#default = {{{1|{{PAGENAME}}}}}
}} }}</includeonly><noinclude><!--
}} }}</includeonly><noinclude><!--

Revision as of 20:37, 16 August 2012

A simple template that removes initial numerals and articles from the work title.

Syntax:

{{WorkSorter}} returns the contents of {{PAGENAME}} after processing it.

Syntax with an optional parameter:

{{WorkSorter|2 Tantum Ergo (Franz Schöpf)}} returns "Tantum Ergo (Franz Schöpf)"


This template can be used in conjunction with the magic word DEFAULTSORT inside Works pages, to produce an appropriate sort key.

{{DEFAULTSORT:{{WorkSorter}}}}