Help:Automating the work list on composer pages

From ChoralWiki
Jump to: navigation, search

Adding new works or editions to ChoralWiki has so far implied that two pages are created or edited: the work page; and the relevant composer page.

To simplify the add work process, especially for the benefit of new contributors, it is envisaged that composer pages are gradually modified in such a way that the work list on them is automatically updated whenever a new work or a new edition is added. Most composer pages have been modified already.

At the present time a simple function exists, which can be used to automate the work list on composer pages. The function is named SortWorks, and it should be invoked as follows:

{{#SortWorks:}}
or
{{#SortWorks:<subcategory>}}
or
{{#SortWorks:<subcategory>|cols=<number of columns>}}


When included in a composer page it automatically creates an alphabetical listing of the works by that composer. The optional <subcategory> parameter restricts the listing only to the pages that belong to the selected subcategory. For example:

{{#SortWorks:Sacred music}}

will only list the sacred works by the composer, alphabetically sorted.

Please note that SortWorks bases its output on Category:Composer_Name_compositions. Sorting is done according to the rules applied by the MediaWiki software to the above mentioned category. Therefore, the sorting order can be controlled using, for example, the {{DEFAULTSORT:sortkey}} magic word. For details, see Mediawiki documentation on sorting categories and on magic words.

If a number of columns is specified, the list of works is distributed accordingly. Otherwise, default rules are applied.

Multiple subcategories can be specified, separated by "&&" (logical AND) or "$$" (logical OR) strings. For example:

{{#SortWorks:Sacred music&&Works in Latin}}   will only list the sacred works in Latin language by the composer
{{#SortWorks:Sacred music$$Works in Latin}}   will list all sacred works and all works in Latin language by the composer

"&&" and "$$" operators cannot be used in the same expression.

A subcategory may be excluded by adding a "!" character before the subcategory name. For example:

{{#SortWorks:Sacred music&&!Works in Latin}}   will only list the sacred works in any language except Latin
{{#SortWorks:Sacred music$$!Works in Latin}}   will list all sacred works and all works in any language except Latin

The SortWorks function is currently suitable for composer pages that are relatively simple (one or two outline levels, no works within works). It will be progressively improved and complemented with other functions, so that it will be possible to extend the work list automation to more complex composer pages, with the goal that the works list is automated on all ChoralWiki's composer pages.

Whenever a new work or a new edition is added, contributors are kindly invited to consider the automation of the work listing on the composer page using the SortWorks function.

If you include the SortWorks function on a page, the works will be shown twice, once by the previously existing code entered manually, and once by the function. Please check if all works entered manually are contained in the list created by the SortWorks function. If not, try to find the reason for the work missing and correct it. This reason may be a composer name with a different spelling or a category set incorrectly. If there are no missing works left, the previously existing code containing the manually entered works can be removed.

This page is part of the CPDL Help system.
View main help index