Page MenuHomePhabricator

Initial character lettercase interferes with display of a redirected title
Closed, InvalidPublic

Description

The 'display title of redirect page' feature seems to have some issues if the first character of a link is lowercase.

For example, if Test is redirected to Test Page then:

  • [[Test]] correctly displays as 'Test Page'
  • [[test]] incorrectly displays as 'test'

It also goes wrong with pipes, if the link-text part (after the pipe) is identical to the target title and is uppercase:

  • [[Test|test]] correctly displays as 'test'
  • [[test|test]] correctly displays as 'test'
  • [[test|Test]] incorrectly displays as 'Test Page'
  • [[Test|Test]] incorrectly displays as 'Test Page'

Event Timeline

cicalese added a subscriber: cicalese.

I finally had a chance to create unit tests to cover all (hopefully) possibilities (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DisplayTitle/+/447112) and document the behavior at https://www.mediawiki.org/wiki/Extension:Display_Title#Linking. The behavior you observed is actually consistent and intentional, with the following rationale.

A link [[a]] is treated as shorthand for [[A|a]]. That is, it is interpreted assuming that the user provided the lowercase initial letter on purpose to use that as link text.

The display title is displayed when no link text is provided ([[A]]) or when the link text provided exactly matches the actual page title ([[A|A]] or [[a|A]]). It is necessary for [[A|A]] to display the displaytitle due to the way links are returned in SMW query results (or at least that was the case when DisplayTitile was originally written - I'm unsure if that's still the case). That's a shame, since that would have been a nice way to signal that the user did not want to use the display title for that link. [[a|A]] could be argued either way - what was the intent of the user? However, it's a moot point, because the point at which the decision is made cannot differentiate between [[A|A]] and [[a|A]], since the text of the page title as it exists in the wikitext is not available from MediaWiki at that point in the code.

As such, I do not believe there is an error. Feel free to reopen if you disagree.