Page MenuHomePhabricator

Template in wikilink target position also returns pipe separated params
Open, NormalPublicBug

Description

Requesting this url (MCS): https://eu.wikipedia.org/api/rest_v1/page/mobile-sections/Kreischa
Includes the text:

estatuan kokatuta dago, [[<span>Sächsische Schweiz-Osterzgebirge (barrutia)|Sächsische Schweiz-Osterzgebirge</span>]] barrutian.

Original article: https://eu.wikipedia.org/wiki/Kreischa

This seems like a Parsoid/MCS bug to me - am I mistaken?

This is causing MWOffliner output to contain errors (https://github.com/openzim/mwoffliner/issues/716)

Thanks Guys

Event Timeline

Isnit001 created this task.Jun 25 2019, 3:22 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This simplifies as, [[{{1x|Main{{!}}Page}}]]

Parsoid,

<p data-parsoid='{"dsr":[0,24,0,0]}'>[[<span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]],"dsr":[2,22,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Main{{!}}Page"}},"i":0}}]}'>Main|Page</span>]]</p>

Legacy,

<p><a href="/index.php?title=Main&amp;action=edit&amp;redlink=1" class="new" title="Main (page does not exist)">Page</a>
</p>

We're supposed to have some smarts about this,
https://github.com/wikimedia/parsoid/blob/c6efefcfea6a8245c71bff92cb0dc3f3a6c053bc/lib/wt2html/tt/WikiLinkHandler.js#L313-L323

but that's probably unreachable since | is an invalid title char,
https://github.com/wikimedia/mediawiki-title/blob/master/test/index.js#L43

Arlolra triaged this task as Normal priority.Jun 25 2019, 6:52 PM
Arlolra moved this task from Backlog to Link syntax (links & media) on the Parsoid board.
Arlolra renamed this task from Getting wikitext [[ from MCS on EU wiki to Template in wikilink target position also returns pipe separated params.Jun 25 2019, 6:56 PM

Change 519093 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Test for pipe before trying to resolve target

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

At this point, I am tempted to say, this is pretty much a won't support scenario. Ideally, we would detect this wikitext pattern and flag it for wikis to fix their wikitext so that code can be supported unless of course this usage is very common practice. But, given that it has taken these many years for someone to notice this breakage indicates that this is likely not very common. If we want to proceed down the path of independent parsing futures, [[ {{template}} ]] will only parse as a link in the case where {[template}} yields a valid link (which we currently support). But if the templateyields pieces of syntax that has to be combined with other syntax from the top-level page that then happens to resemble a wikilink, then that is not something we want to encourage and support going forward.

Change 519093 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Test for pipe before trying to resolve target

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

Kelson added a subscriber: Kelson.Jul 1 2019, 5:42 PM

Mentioned in SAL (#wikimedia-operations) [2019-07-24T21:18:52Z] <cscott@deploy1001> Finished deploy [parsoid/deploy@abd05ab]: Updating Parsoid to df1af404 (T227216, T226523, T226451) (duration: 18m 35s)

I don't think the last fix deployment has fixed anything regarding that ticket. The Parsoid output is still broken so far I can see.

I don't think the last fix deployment has fixed anything regarding that ticket. The Parsoid output is still broken so far I can see.

It didn't intend to. It just moved some dead code that was supposed to run in this case up to where it was reachable. The decision about how to handle it is still in the air.

I don't think the last fix deployment has fixed anything regarding that ticket. The Parsoid output is still broken so far I can see.

@Kelson: T226523#5284292 is where we stand on this currently.