{{DEFAULTSORT}} not applied to things inside <ref> if defaultsort appears after <references/>
Closed, ResolvedPublic

Description

Author: storkk

Description:
This behavior is observable on the English Wikipedia. For example, https://en.wikipedia.org/wiki/Brian_King uses the magic word, as: {{DEFAULTSORT:King, Brian}} - it works inconsistently: in https://en.wikipedia.org/wiki/Category:People_educated_at_Sydney_Boys_High_School he is sorted under K. However, for some categories, e.g. https://en.wikipedia.org/wiki/Category:Articles_with_invalid_ISBNs he is sorted under B. The category contains numerous examples of correctly interpreted {{DEFAULTSORT}}s (e.g. https://en.wikipedia.org/wiki/Dodie_Bellamy ) and incorrectly interpreted ones (all the Michaels here: https://en.wikipedia.org/w/index.php?title=Category:Articles_with_invalid_ISBNs&pagefrom=Mi ).


Version: unspecified
Severity: normal

bzimport added a project: Cite.Via ConduitNov 22 2014, 1:35 AM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz44676.
bzimport created this task.Via LegacyFeb 5 2013, 1:13 PM
bzimport added a comment.Via ConduitFeb 5 2013, 6:33 PM

storkk wrote:

Note: there is a discussion regarding this behavior here: http://en.wikipedia.org/wiki/Help_talk:Category#DEFAULTSORT_inconsistency_.28.3F.29

Bawolff added a comment.Via ConduitFeb 5 2013, 6:53 PM

That's interesting. I wonder if it could possibly be related to that old bug where magic words were not recognized during reparses happening via the job queue (although I believe that was long fixed) [Can't find bug number at the moment]

Bawolff added a comment.Via ConduitFeb 5 2013, 11:43 PM

Oh, its because its inside a <ref> (Causes the {{Defaultsortkey}} not to be applied, and for that template not to be expanded in the expandtemplates call i listed in comment 3)

Bawolff added a comment.Via ConduitFeb 5 2013, 11:51 PM

Sorry, I updated the bug a little too quickly. It only happens if the {{DEFAULTSORT}} comes after the <references/> list.

Minimal test case: https://en.wikipedia.org/w/api.php?text=%3Cref%3E[[category:foo]]%3C/ref%3E%3Creferences/%3E{{DEFAULTSORT:bar}}&action=parse&prop=categories

(Expected behaviour is for that query to have same output as https://en.wikipedia.org/w/api.php?text=%3Cref%3E[[category:foo]]%3C/ref%3E{{DEFAULTSORT:bar}}%3Creferences/%3E&action=parse&prop=categories

bzimport added a comment.Via ConduitFeb 6 2013, 12:48 AM

storkk wrote:

Unfortunately, it may be a little more complex, or there may be another bug to find. The bug you found the minimal test case for doesn't seem to account for the fact that on some categories, the DEFAULTSORT _is_ taken into account (e.g. Brian King in Category:People_educated_at_Sydney_Boys_High_School ).

Bawolff added a comment.Via ConduitFeb 6 2013, 1:01 AM

(In reply to comment #7)

Unfortunately, it may be a little more complex, or there may be another bug
to
find. The bug you found the minimal test case for doesn't seem to account for
the fact that on some categories, the DEFAULTSORT _is_ taken into account
(e.g.
Brian King in Category:People_educated_at_Sydney_Boys_High_School ).

That category is not inside a <ref> tag.

So if this was an example article

Lorem ipsum dolor sit amet,
[[category:Foo]] consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<ref>[[category:Bar]]</ref> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<references/>
{{DEFAULTSORT:xyzzy}}
Excepteur sint
[[category:Baz]]
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Category Foo and Baz would have the sortkey xyzzy, while Bar (being inside a <ref>) would have the page's name as the sortkey. If {{DEFAULTSORT:xyzzy}} was moved before the <references/> tag, then all three would have xyzzy as their sortkey.

bzimport added a comment.Via ConduitFeb 6 2013, 2:43 AM

storkk wrote:

I misunderstood what you were saying. Apologies.

Bawolff added a comment.Via ConduitFeb 6 2013, 3:07 AM

(In reply to comment #9)

I misunderstood what you were saying. Apologies.

No worries, I was a bit unclear the first time around.

Bawolff added a comment.Via ConduitFeb 7 2013, 4:03 PM
  • This bug has been marked as a duplicate of bug 38435 ***

Add Comment