Help:Automating the work list on composer pages: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(added last paragraph telling how to proceed when including this function in a code)
(Added clarification about the relationship with "Category:Composer_Name_compositions" and specified that most composer pages have been automated already)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
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.
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 same time, direct links to files (pdf, midi, etc.) on the composer page are supposed to be gradually removed. This is to prevent misalignments of links between the work page and the composer page, and, especially, to ensure that copyright information and editor credits are shown before a user can download any files.


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:
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:
Line 10: Line 8:




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


<center>'''<nowiki>{{#SortWorks:Sacred music}}</nowiki>'''</center>
<center>'''<nowiki>{{#SortWorks:Sacred music}}</nowiki>'''</center>


will only list the sacred works by the composer, alphabetically sorted.
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 ''<nowiki>{{DEFAULTSORT:sortkey}}</nowiki>'' magic word. For details, see Mediawiki documentation on [https://www.mediawiki.org/wiki/Help:Categories#Sort_key sorting categories] and on [https://www.mediawiki.org/wiki/Help:Magic_words magic words].


If a number of columns is specified, the list of works is distributed accordingly. Otherwise, default rules are applied.
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:
::'''<nowiki>{{#SortWorks:Sacred music&&Works in Latin}}</nowiki>'''&nbsp;&nbsp;&nbsp;will only list the sacred works in Latin language by the composer
::'''<nowiki>{{#SortWorks:Sacred music$$Works in Latin}}</nowiki>'''&nbsp;&nbsp;&nbsp;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:
::'''<nowiki>{{#SortWorks:Sacred music&&!Works in Latin}}</nowiki>'''&nbsp;&nbsp;&nbsp;will only list the sacred works in any language except Latin
::'''<nowiki>{{#SortWorks:Sacred music$$!Works in Latin}}</nowiki>'''&nbsp;&nbsp;&nbsp;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.
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.

Latest revision as of 20:43, 8 January 2019

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