Bug: words omitted for sorting ignored in daughter category

Moderators: kcleung, Wiki Admins

Post Reply
pml
Copyright Reviewer
Posts: 1219
Joined: Fri Mar 16, 2007 3:42 am
notabot: 42
notabot2: Human
Location: Melbourne, Australia
Contact:

Bug: words omitted for sorting ignored in daughter category

Post by pml »

The words in various languages which we normally exclude from sorting rules, e.g. A, The, La, Le, Les, Der, Die, Das, Il, and so on, do not appear to be omitted when the page in question is a member of a daughter category. For example, Les Troyens sorts under T in Berlioz’s default category: as he is also categorised as an arranger (vocal score) and librettist (author) the work however sorts under L instead of T, in the daughter categories /Arranger and /Librettist. I've noticed similar oddities with composers elsewhere, generally in daughter categories.

Naturally these problems may have gone somewhat unnoticed until multiple categories were yoked into close quarters on the one page!

Cheers, PML
--
PML (talk)
Davydov
Copyright Reviewer
Posts: 816
Joined: Sun Aug 17, 2008 8:31 am
notabot: 42
notabot2: Human
Contact:

Re: Bug: words omitted for sorting ignored in daughter categ

Post by Davydov »

It has been noticed and reported to Feldmahler, who was up very late last night fixing other things. I'm sure he'll get round to it :)
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Re: Bug: words omitted for sorting ignored in daughter categ

Post by imslp »

With great regret I announce the availability of the {{#worksortkey:}} parser function. Add it to the category inclusions in the {{Link}} templates to make it sort correctly, e.g. [[Category:Schubert, Franz{{#worksortkey:}}]].

I reserve the right to convert all {{Link}} templates into something more efficient in the future. ;) This is especially because there are now enough pages linked to the {{Link}} templates that changing the templates may cause a temporary overloading of the server (but then again there is no other way at the moment). Therefore, be judicious in your editing of those templates.
Davydov
Copyright Reviewer
Posts: 816
Joined: Sun Aug 17, 2008 8:31 am
notabot: 42
notabot2: Human
Contact:

Re: Bug: words omitted for sorting ignored in daughter categ

Post by Davydov »

I've just tried it on {{LinkArr}}, and it seems to work — not that there could be any serious doubt about that! :)

It will take time for the cache to catch up with all the links, and bearing in mind Feldmahler's comments above, we should wait a good few hours before implementing the same on {{LinkEd}}, {{LinkTr}} and {{LinkLib}}, with decent time intervals between each of them.
pml
Copyright Reviewer
Posts: 1219
Joined: Fri Mar 16, 2007 3:42 am
notabot: 42
notabot2: Human
Location: Melbourne, Australia
Contact:

Re: Bug: words omitted for sorting ignored in daughter categ

Post by pml »

I just noticed Davydov created a generic version of the {{LinkX}} templates, {{LinkName}}. I’ve added the following code included in the switch statement. It can essentially replace all five of the current templates in wide use, LinkComp/Arr/Ed/Lib/Tr:

Code: Select all

<includeonly>{{ #if: {{{2|}}} |[[:Category:{{{2}}}, {{{1}}}|{{{1}}} {{{2}}}]]|[[:Category:{{{1}}}|{{{1}}}]]}}{{ #switch: {{lc: {{{t}}} }}
|arr={{ #if: {{{2|}}} |[[Category:{{{2}}}, {{{1}}}/Arranger{{#worksortkey:}}]]|[[Category:{{{1}}}/Arranger{{#worksortkey:}}]]}}
|ed={{ #if: {{{2|}}} |[[Category:{{{2}}}, {{{1}}}/Editor{{#worksortkey:}}]]|[[Category:{{{1}}}/Editor{{#worksortkey:}}]]}}
|lib={{ #if: {{{2|}}} |[[Category:{{{2}}}, {{{1}}}/Librettist{{#worksortkey:}}]]|[[Category:{{{1}}}/Librettist{{#worksortkey:}}]]}}
|tr={{ #if: {{{2|}}} |[[Category:{{{2}}}, {{{1}}}/Translator{{#worksortkey:}}]]|[[Category:{{{1}}}/Translator{{#worksortkey:}}]]}}
|
}}</includeonly>
If only one or two standard variables are presented, it behaves like {{LinkComp}}; if a third variable t=X is presented, where X is one of the possible types {{ Arr | Ed | Lib | Tr }} (case insensitive) then it adds the appropriate daughter category, which is part and parcel of the variant {{LinkX}} templates.

Thus the following are equivalent:

{{LinkArr|Fred|Nerk}} and {{LinkName|t=Arr|Fred|Nerk}}; by adding [[Category:Nerk, Fred/Arranger]] (sortkey optional ;)
{{LinkEd|Fred|Nerk}} and {{LinkName|t=Ed|Fred|Nerk}}; by adding [[Category:Nerk, Fred/Editor]]
{{LinkLib|Fred|Nerk}} and {{LinkName|t=Lib|Fred|Nerk}}; by adding [[Category:Nerk, Fred/Librettist]]
{{LinkTr|Fred|Nerk}} and {{LinkName|t=Tr|Fred|Nerk}}; by adding [[Category:Nerk, Fred/Translator]]
{{LinkComp|Fred|Nerk}} and {{LinkName|Fred|Nerk}} — no category is added.

(Also note that because t is a declared variable, it can appear in any order in the template, before, after or inbetween the two name variables.)

I doubt this is the most efficient way the function may be programmed – which Edward has said he would like to reserve for his pleasure! The use of the switch is obviously extensible to cover any new types of category desired (such as Perlnerd’s suggestion of Dedicatees of compositions).
Last edited by pml on Mon Feb 07, 2011 12:16 pm, edited 1 time in total.
Reason: Added the fifth and final case in the switch statement in bold – this is the default action. To counter the misunderstanding below.
--
PML (talk)
imslp
Site Admin
Posts: 1642
Joined: Thu Jan 01, 1970 12:00 am

Re: Bug: words omitted for sorting ignored in daughter categ

Post by imslp »

I would love dearly to move that into FTE space. On the other hand, there are already too many moving parts, and I might wait for a week or two for the dust to settle down before doing any other massive changes. In the meanwhile the current system can be kept de facto.
Davydov
Copyright Reviewer
Posts: 816
Joined: Sun Aug 17, 2008 8:31 am
notabot: 42
notabot2: Human
Contact:

Re: Bug: words omitted for sorting ignored in daughter categ

Post by Davydov »

Actually, the "LinkName" template was intended to replace "LinkComp" and used when you just wanted to mention a person and link to their home category, without defining them as composer, arranger, librettist, etc of the page from which you are linking. So {{LinkComp|Ludwig van|Beethoven}} would create a link in the form [[:Category:Beethoven, Ludwig van|Ludwig van Beethoven]]. The new modifications to the template don't seem to allow for this :-(
pml
Copyright Reviewer
Posts: 1219
Joined: Fri Mar 16, 2007 3:42 am
notabot: 42
notabot2: Human
Location: Melbourne, Australia
Contact:

Re: Bug: words omitted for sorting ignored in daughter categ

Post by pml »

I think you misunderstand – the categories are only added in the event the switch is given a specific value, because otherwise it has a blank default (the last line of the switch). In other words, it does behave like LinkComp normally: the t variable must be added to make it behave like the other templates (LinkAdd/Ed/Lib/Tr). (Try it!)

Cheers, Philip

PS By the way, LinkComp was even more simple-minded than LinkName, before I added the switch – it was unable to cope with the name being given as a single variable (e.g. Anonymous) rather than two (e.g. {{LinkComp|Fred|Nerk}}).
--
PML (talk)
Post Reply