Page MenuHomePhabricator

Provide "wikitext" means of accessing arbitrary wiki page's default category sort key
Open, Needs TriagePublic

Description

https://en.wikipedia.org/w/index.php?title=Talk:Thomas_W._O%27Brien&diff=757480527&oldid=610994123

Edits such as this are taking the subject-space page's default category sort key and putting it on the talk page. There are hundreds, probably thousands, of similar edits. This is kind of insane and we should address this in a better way.

Instead of duplicating the default category sort key between the subject-space page and the talk page, let's provide a means of accessing/extracting the default category sort key of an arbitrary wiki page from a wiki talk page.

I can see two relatively straightforward paths to providing this functionality:

  1. Add a function or property to Scribunto/Lua to get the default category sort key of a Title object. I looked at https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual and didn't see one already, unfortunately.
  2. Add a magic word or parser function (cf. https://www.mediawiki.org/wiki/Help:Magic_words) such as {{#getdefaultsortkey:Page name}} or similar that can retrieve a wiki page's default category sort key. Or it could be similar to {{PAGESIZE:Page name}} or perhaps could even be integrated with the existing {{DEFAULTSORT:}}, but that seems kind of messy.

Thoughts on which approach to take? Once there's a decision, implementing this functionality should be pretty easy.

Event Timeline

Restricted Application added subscribers: TerraCodes, Aklapper. · View Herald TranscriptDec 31 2016, 1:40 AM

Add a function or property to Scribunto/Lua to get the default category sort key of a Title object

Related is T131911, which is about exposing a different set of page_props information via Scribunto/parser functions

Jackmcbarn added a subscriber: Jackmcbarn.

I dislike the idea of exposing through the parser any properties that can be set via the parser.

I dislike the idea of exposing through the parser any properties that can be set via the parser.

Okay. Do you dislike the {{#ifexist:Page name}} ParserFunction parser function?

I want to be able to get and use a page's stored metadata value on a separate page, in this case using the subject-space page's default category sort key on its talk page. How would you recommend this be implemented? Would using Scribunto/Lua for this be acceptable to you? Are there other implementation options to discuss and consider?

Do you dislike the {{#ifexist:Page name}} ParserFunction parser function?

No, since the output of the parser can't change whether or not a page exists. Basically, I don't like things that could cause paradoxes if called on themselves, or on other pages in a loop. (See also my response to T71441).

One thought brought up during discussion of T154738 was changing the default behavior of sorting talk pages so that talk pages sort by the subject-space's default category sort key. For example, in the case of the subject-space page "Barack_Obama", if this subject-space page had a default category sort key of "Obama, Barack", then the page "Talk:Barack_Obama" would automatically default to using this sort key, unless otherwise specifically overridden on the talk page via {{DEFAULTSORT:}}.