Page MenuHomePhabricator

[Migrated] Incorrect preview of the 'pipe trick'
Closed, ResolvedPublic


ospalh (talk) 09:50, 5 May 2010 (UTC) wrote:

Wikilinks in the format of, [[Washington (U.S. state)|]] are shown as [[Washington (U.S. state)|]] in the preview, instead of [[Washington (U.S. state)|Washington]]. For details of the notation see Help:pipe trick.

Duplicate: Change some link piped to a redirect page to the [[NN (x)|]], format. Press Preview.
OS: Windows Vista
.NET: 2.0.50727.3603
Version: 5.0.2.*
Workaound: Ignore the preview or don't use the pipe trick.

Event Timeline

Josve05a raised the priority of this task from to Needs Triage.
Josve05a updated the task description. (Show Details)
Josve05a added a project: AutoWikiBrowser.
Josve05a added a subscriber: Josve05a.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 15 2015, 10:21 PM

@Reedy 09:58, 5 May 2010 (UTC) wrote:

Which preview? ie on loading show preview/changing the preview? If so, it would seemingly be the API returning the wrong HTML to render...

ospalh (talk) 10:31, 5 May 2010 (UTC) wrote:

I usually have the preference on "On loading show changes", but tried the two others as well. Makes no difference. Either you can see the problem immediately (when the change is done automatically) or after pressing the Preview button on the Start tab. "the API returning the wrong HTML to render": looks like that to me, too.

@Reedy 10:55, 5 May 2010 (UTC) wrote:

It seems, when you attempt to save [[Washington (U.S. state)|]] in a page on current WMF release of mediawiki, it saves [[Washington (U.S. state)|Washington]].

ospalh (talk) 11:01, 5 May 2010 (UTC), 11:07, 5 May 2010 (UTC) wrote:

Yes, that's why it's called the trick and listed under Help:Magic. I guess not using the pipe trick on automatic changes would be the Right Thing, but i like to use the trick on manual changes. If you use the trick in a web browser and use the "normal" Show preview button there, [[Washington (U.S. state)|]] is shown as [[Washington (U.S. state)|Washington]] (edited), different from what happens in AWB.

Auntof6 (talk) 11:57, 5 May 2010 (UTC) wrote:

I've seen this, too.

Josve05a added a comment.EditedMay 15 2015, 10:27 PM

TwinsMetsFan 13:30, 5 May 2010 (UTC) wrote:

I've seen it as well. I've always assumed it was because of the API, since if you edit an article in a browser, add a pipe-tricked linked link, and click show changes, it shows the link being piped. Same thing with subst'ed templates: show changes in a browser shows it subst'ed, show changes in AWB doesn't.

@Reedy 20:18, 5 May 2010 (UTC) wrote:

I'll have to look into it. Depending on the configuration of how this works, is whether it'd be worth dealing with directly in AWB. Or if the API should be applying the pipetrick on the generated preview etc.

Josve05a set Security to None.

Rich Farmbrough 19:33, 7 September 2010 (UTC) wrote:

I'd lay money it's the API.

@Rjwilmsi 12:08, 28 March 2013 (UTC) wrote:

API preview does not transform the pipe trick in to an HTML link. To me seems better that the API handle this (pipe trick works for preview via Wikipedia edit page through browser).

Anomie added a subscriber: Anomie.May 16 2015, 12:04 AM

Random guess of "it's the API" isn't terribly helpful. If you think it's the API, what's the specific API query being made?

I note that the most obvious query that might be used as a preview,[[Washington%20%28U.S.%20state%29|]]&pst=1, renders the HTML correctly.

I note that the most obvious query that might be used as a preview,[[Washington%20%28U.S.%20state%29|]]&pst=1, renders the HTML correctly.

Yeah for the basic query being done, action=parse&prop=text on the GET and title=FOO&text=BAR&disablepp= in the POST parameters[[Washington%20%28U.S.%20state%29|]]&disablepp=

    "parse": {
        "title": "Foo",
        "text": {
            "*": "<p>[[Washington (U.S. state)|]]</p>\n\n"

vs[[Washington%20%28U.S.%20state%29|]]&pst=1 (only relevant part of output displayed)

"text": {
    "*": "<p><a href=\"/wiki/Washington_(U.S._state)\" title=\"Washington (U.S. state)\" class=\"mw-redirect\">Washington</a></p>\n\n\n<!-- \nNewPP limit report\nParsed by mw1228\nCPU time usage: 0.006 seconds\nReal time usage: 0.007 seconds\nPreprocessor visited node count: 1/1000000\nPreprocessor generated node count: 0/1500000\nPost\u2010expand include size: 0/2097152 bytes\nTemplate argument size: 0/2097152 bytes\nHighest expansion depth: 1/40\nExpensive parser function count: 0/500\n-->\n\n<!-- \nTransclusion expansion time report (%,ms,calls,template)\n100.00%    0.000      1 - -total\n-->\n"

The lack of &pst= being the difference, and seemingly the key here?[[Washington%20%28U.S.%20state%29|]]&disablepp=&pst=

    "parse": {
        "title": "Foo",
        "text": {
            "*": "<p><a href=\"/wiki/Washington_(U.S._state)\" title=\"Washington (U.S. state)\" class=\"mw-redirect\">Washington</a></p>\n\n"


For developers: the pipe trick is implemented in the pre-save transform helper function pstPass2() of includes/parser/Parser.php

So yeah, it's the pst that's making the difference.

May I just note that this was stalled for 5 years, and now due to this being migrated to Phabricator, it got solved within an hour or so :D