uc/lcfirst: magic word should work with link titles
Open, Needs TriagePublic

Description

Steps to reproduce

  1. Open an editor
  2. Insert {{ucfirst:[[Linked page|link title]]}}

Expected behavior
Link title

Current behavior
link title

Dvorapa created this task.Thu, Dec 6, 8:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptThu, Dec 6, 8:15 PM
Dvorapa renamed this task from uc/lcfirst: magic word should skip link brackets to uc/lcfirst: magic word should work with link litles.Thu, Dec 6, 8:15 PM
Dinoguy1000 renamed this task from uc/lcfirst: magic word should work with link litles to uc/lcfirst: magic word should work with link titles.Fri, Dec 7, 12:28 AM

The current behavior of these functions is very straightforward: to change the case of the first character in the string passed to them (therefore, previewing {{ucfirst:[[test]]} renders as "test", not as "Test", because the first character is the first [, not the t). Changing the behavior of these functions to be link-aware would require changing at what point in the parse process they are applied, and would probably be extremely difficult to do without introducing a wide array of bugs and unintended behaviors, in addition to potentially breaking lots of current usage that relies on the current behavior. The best solution for this is to change your use case so the functions are being applied directly to the text you want to modify - i.e. [[Linked page|{{ucfirst:link title}}]].

[[Linked page|{{ucfirst:link title}}]]

Sometimes this is not possible. Like in infobox parameters. In my yesterday's infobox the lowercase letter was needed when filled in name and season parameters together:

| name = something
| season = 12
output: 12. something

But uppercase letter when filled only name parameter:

| name = something
output: Something

This works with ucfirst really well, until user inserts a link into the name parameter.

It is possible with a module. I find it unlikely the developers are going to enable this behavior with any pure-wikitext method given that.