Page MenuHomePhabricator

defaultsort's noreplace argument not working as expected.
Open, MediumPublic

Description

[22:48] <Technical_13> Can I get some clarification for the DEFAULTSORT |noreplace switch? I used it in a template that goes at the top of a page expecting it to lock that in as the defaultsort, but it doesn't seem to be working that way. Anyone have a solution for this?
[22:49] * You are now known as T13|sleeps
[22:49] <Elsie> T13|sleeps: Please include a link to what you're talking about.
[22:50] <T13|sleeps> http://enwp.org/Template:AFC_submission/declined
[22:53] <T13|sleeps> [[Category:G13 eligible AfC submissions]]{{DEFAULTSORT:{{padleft:{{#expr:(({{#time:y|{{REVISIONTIMESTAMP}}}}*12)+{{REVISIONMONTH1}})}}|3|0}}|noreplace}}
[22:54] <T13|sleeps> ^^^ that part of code
[22:56] <T13|sleeps> If you check out some of the submissions that are in the G13 eligible cat there that are under a letter you will see at the bottom of those pages defaultsort "###" replaced with blah...
[22:58] <T13|sleeps> http://en.wikipedia.org/wiki/Category:G13_eligible_AfC_submissions
[22:58] <T13|sleeps> Is the link to cat
[22:59] <T13|sleeps> http://en.wikipedia.org/wiki/Wikipedia_talk:Articles_for_creation/charlie_zelenoff
[22:59] <T13|sleeps> Is a link to an overridden defaultsort example
[23:00] <T13|sleeps> Warning: Default sort key "Zelenoff, Charlie" overrides earlier default sort key "148"
[23:00] <T13|sleeps> Is the message I get but wasn't expecting because noreplace up top I thought would prevent it.

I would expect that argument to make the parser stop looking for defaultsort magic word.


Version: 1.22.0
Severity: normal

Details

Reference
bz52208

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:59 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz52208.
bzimport added a subscriber: Unknown Object (MLST).

DEFAULTSORT has to come above the category.

Okay, let me clean up my notes from IRC last night when I was half asleep and on my mobile device which isn't very useful for editing...

I would expect:
{{DEFAULTSORT: stuff |noreplace}}
with the "noreplace" argument/parameter to lock that default sort in for the rest of the page, regardless if I had it in the right place for that category I wanted to use it on. As a side note, it actually was using the defaultsort after the category for the ones that didn't have conflicting defaultsort declarations elsewhere on the page.

However, all of the "Joe Smith" drafts in the category http://en.wikipedia.org/wiki/Category:G13_eligible_AfC_submissions that also had a {{defaultsort:Smith, Joe}} on the page were returning an error such as 'Warning: Default sort key "Zelenoff, Charlie" overrides earlier default sort key "148"'

I would expect the "|noreplace}}" to prevent that based on the description (It can take a second argument of noerror or noreplace to suppress error messages when multiple defaultsortkeys are used on one page or to make it do nothing if multiple defaultsortkeys are used.) at the www.mediawiki.org/wiki/Help:Magic_words#DEFAULTSORT page.

(In reply to comment #2)

I would expect:
{{DEFAULTSORT: stuff |noreplace}}
with the "noreplace" argument/parameter to lock that default sort in for the
rest of the page, regardless if I had it in the right place for that
category I
wanted to use it on. As a side note, it actually was using the defaultsort
after the category for the ones that didn't have conflicting defaultsort
declarations elsewhere on the page.

Umm, noreplace does the opposite. {{defaultsort:foo|noreplace}} means use default sort of 'foo', but if there was already a default sort specified, do not replace it.

I don't think we should be able to override sorts specified on the category tag. More specific things should take precedence.

To be explicit: I think this bug should be closed wontfix, but am open to being convinced otherwise.