Page MenuHomePhabricator

lcfirst and ucfirst parser functions do not work on wikilinks
Open, LowPublic

Description

Author: codecat42

Description:
The parser functions {{lcfirst: and {{ucfirst: do not work when the text they operate on begins with a wikilink. This is the expected behaviour on a textual level, as a wikilink begins with a [ character which is not a letter. However, it is not the behaviour that would be expected on a wiki, since the more useful behaviour in the majority of cases would be that it makes the first character of the link text (not the link target) uppercase or lowercase. E.g. {{ucfirst:[[hello|foo]]}} should be replaced with [[hello|Foo]].


Version: unspecified
Severity: minor

Details

Reference
bz24636

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:59 PM
bzimport set Reference to bz24636.
bzimport added a subscriber: Unknown Object (MLST).

Recommend WONTFIX. ucfirst/lcfist are doing exactly what the documentation says: uppercasing/lowercasing the first character of their input. In this case the first character is [ , which has no uppercase or lowercase variants.

msh210+wmfbugzilla wrote:

I agree (with Roan Kattouw) they are acting as described. The recommendation of the bug report is to change that action. My opinion FWIW: Changing the action of ucfirst/lcfirst will break current implementation, ruining backward compatibility, and should not be done. However, it would be nice to have a similar function that acts as requested in the bug report. Call it something else and add it to the software (or an extension). It should not only replace {{ucfirstmodulomarkup:[[foo|bar]]}} with [[foo|Bar]] but also e.g. {{ucfirstmodulomarkup:<div><h1><a href="http://example.com/"><span id="foo">bar</span></a></h1></div>}} with <div><h1><a href="http://example.com/"><span id="foo">Bar</span></a></h1></div>.

codecat42 wrote:

I agree that modifying the existing behaviour isn't a good idea, but making a new function that does what msh210 describes sounds good.