Page MenuHomePhabricator

Using the shortcut pipe trick for links doesn't output correctly in MediaWikiChat
Closed, ResolvedPublic

Description

Trying to link to Special:RecentChanges via [[Special:RecentChanges|]] should output as "RecentChanges" but instead outputs as it's input, which again, is "[[Special:RecentChanges|]]".

Event Timeline

SamanthaNguyen moved this task from Backlog to Bugs on the MediaWikiChat board.
SamanthaNguyen moved this task from Backlog to MediaWikiChat on the Brickimedia board.

Ooh I didn't even know that was a thing in normal wikitext... :D I'll have a look, I would have expected that to work as I thought MWC used the same parser as normal wikitext.

hmm, looks like there is some sort of pre-parsing for this trick: https://en.wikipedia.org/wiki/Help:Pipe_trick

ashley added a subscriber: ashley.Dec 22 2016, 5:17 PM

You'll probably want Parser's preSaveTransform.

Quick example code you can run in /maintenance/eval.php to try it out:

global $wgParser;
$user = User::newFromName( 'Jack Phoenix' );
$title = Title::newFromText( uniqid( 'tmp' ) );
$options = ParserOptions::newFromUser( $user );
echo $wgParser->preSaveTransform( '[[Special:RecentChanges|]]', $title, $user, $options );

This outputs [[Special:RecentChanges|RecentChanges]].

UltrasonicNXT reopened this task as Open.Dec 23 2016, 5:38 PM
UltrasonicNXT claimed this task.

okay looks like this can be done then

Change 328927 had a related patch set uploaded (by UltrasonicNXT):
Use preSaveTransform to allow the pipe trick among others

https://gerrit.wikimedia.org/r/328927

Change 328927 merged by jenkins-bot:
Use preSaveTransform to allow the pipe trick among others

https://gerrit.wikimedia.org/r/328927

SamanthaNguyen closed this task as Resolved.Dec 23 2016, 6:50 PM
SamanthaNguyen removed a project: Patch-For-Review.