Page MenuHomePhabricator

English Wikisource's MediaWiki:Proofreadpage_index_template does not recognize Sort Key
Open, MediumPublic

Description

https://en.wikisource.org/wiki/MediaWiki:Proofreadpage_index_template configures how to handle parameter "Key" in book indices. If a sort key is specified, the default sort key should be replaced with the specified one. However, it does not work correctly, as you can see if you check the page information of https://en.wikisource.org/wiki/Index:1909historyofdec04gibbuoft.djvu, for example, where the sort key "History of the decline and fall of the Roman Empire" is not reflected. We confirmed that it works by changing the content model of MediaWiki:Proofreadpage_index_template to wikitext. Please see https://en.wikisource.org/wiki/Wikisource:Administrators%27_noticeboard#MediaWiki:Proofreadpage_index_template for details.

Event Timeline

CES1596 renamed this task from [[ws:MediaWiki:Proofreadpage index template]] does not recognize Sort Key to English Wikisource's MediaWiki:Proofreadpage index template does not recognize Sort Key.Mar 22 2019, 5:32 PM
CES1596 updated the task description. (Show Details)
CES1596 triaged this task as High priority.Mar 22 2019, 5:37 PM
CES1596 renamed this task from English Wikisource's MediaWiki:Proofreadpage index template does not recognize Sort Key to English Wikisource's MediaWiki:Proofreadpage_index_template does not recognize Sort Key.Mar 22 2019, 5:49 PM
CES1596 updated the task description. (Show Details)
CES1596 updated the task description. (Show Details)

Thank you for the bug report!

Changing the content model of an Index: pages to Wikitext is definitely not a good idea because it breaks a lot of features on the individual Page: pages of the book and the <pages> tag based translusions.

I believe this problem happens because of the way ProofreadPage renders Index: pages Allowing usage of DEFAULTSORT in MediaWiki:Proofreadpage_index_template is not going to be easy and probably would mean to abandon the hope of fixing the problem with template escaping in Index: pages parameter.

Without much thinking, I believe that the best way to solve this problem would be to add a special field to the Index: pages edit form that would be directly managed by ProofreadPage and would be used to directly set DEFAULTSORT during the page rendering. But this limitation has been there for years and you seem like the first person to raise this problem so, except someone works on it, it will probably not be solved anytime soon.

CES1596 lowered the priority of this task from High to Medium.Mar 25 2019, 2:35 PM

Thank you for your support. I appreciate it if you could do it when you are free.

… the best way to solve this problem would be to add a special field to the Index: pages edit form that would be directly managed by ProofreadPage and would be used to directly set DEFAULTSORT during the page rendering. …

Incidentally, this would have the downside that you would have to use PRP to set the sort key. The main impetus for setting a sort key is removing articles (A, The, etc.) from file names. If handed off to a template we could automate some of this, quite possibly enough that nobody would feel the need to do it manually in the Index: page.

To achieve both you'd need to have a separate hook where PRP calls MediaWiki:ProofreadPage_defaultsort_template and uses its output. At which point this is starting to get kinda complicated.

Alternately, one might think along the lines of letting Lua code manipulate both categories and defaultsorts directly (i.e., through a real API and without spitting out text strings for the parser to deal with). There's a Phab for at least the former bouncing around somewhere (that I'm too lazy to look up just now. T316533 maybe? Or T50175 perhaps?). That way the Key field would be dumb data for PRP (less code) and communities could manage this on their own.