Page MenuHomePhabricator

{{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

Details

Reference
bz44676

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:35 AM
bzimport added a project: Cite.
bzimport set Reference to bz44676.
bzimport added a subscriber: Unknown Object (MLST).

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]

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)

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 ).

(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.

storkk wrote:

I misunderstood what you were saying. Apologies.

(In reply to comment #9)

I misunderstood what you were saying. Apologies.

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

  • This bug has been marked as a duplicate of bug 38435 ***