Page MenuHomePhabricator

Parsoid doesn't convert external links to most sister projects into interwiki links
Open, MediumPublic0 Estimated Story Points

Description

See https://en.wikipedia.org/w/index.php?diff=726361747&oldid=724348641

If you type something, select it, and paste a URL to a Wikivoyage, then it remains an external link ([https://de.wikivoyage.org label]). It should convert to an interwiki link instead ([[wikivoyage:de:|label]]).

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript
Jdforrester-WMF renamed this task from Links to Wikivoyages aren't being transformed correctly into interwiki links to Parsoid doesn't convert external links to most sister projects into interwiki links.Jun 23 2016, 12:22 PM
Jdforrester-WMF added a project: Parsoid.
Jdforrester-WMF subscribed.

From quick testing, WV, WN, WT, WB don't work, but Meta and MW do. Not a very high priority though.

I don't follow this entirely. If I try parsing the following wikitext in the enwiki sandbox, they link to "en:Foo", "fr:boo" on enwikisource and "de:Berlin" on wikivoyage ... so the syntax proposed above is definitely not right.

[[wikisource:en:Foo|foo]]
[[wikisource:fr:boo|boo]]
[[wikivoyage:de:Berlin|Berlin]]

Similarly, the following two link to "frwikisource:boo" and "dewikivoyage:Berlin" on enwiki and not to frwikisource or dewikivoyage pages.

[[frwikisource:boo|boo]]
[[dewikivoyage:Berlin|Berlin]]

So, I don't follow the request yet. Can you clarify the right syntax?

First off, I thought the external link -> interwiki link code was in VisualEditor? Did it get moved to Parsoid?

See https://en.wikipedia.org/w/index.php?diff=726361747&oldid=724348641

In that example, both ru.voy and de.voy are not on en.wp's interwiki map - they are on en.voy's map and the chaining of interwiki links is what make those work. Your en.voy example is flawed, because it was a link to just https://en.wikivoyage.org, which is not actually a wiki page, and cannot be represented as an interwiki link. ("[[voy:]] would link to https://en.wikivoyage.org/wiki/). Using an actual page title appears to work fine: https://en.wikipedia.org/w/index.php?title=User%3AWhatamidoing_%28WMF%29%2Fsandbox&type=revision&diff=726721222&oldid=726679055

There seem to be multiple questions, so let me know if I missed anything:

  1. I actually want [[voy:|Label]] instead of [https://en.wikivoyage.org Label].
  2. I prefer [[s:fr:Foo|Label]], but I don't know whether that one is theoretically more correct than [[frwikisource:boo|Label]].
  3. I have no idea whether this is Parsoid's or VisualEditor's problem to solve.
  4. But I do know that it's broken on office.wiki, and it sounds like it's mostly broken on other sites, too. Perhaps we need a separate task for "update the interwiki maps at hundreds of WMF wikis"?
ssastry triaged this task as Medium priority.Aug 15 2016, 9:30 PM

Some thoughts:

  • I don't think we need to update the interwiki maps to get this functionality
  • Parsoid can add additional logic to chain prefixes of the form <project>:<wikiprefix>:<title> like voy:it:Paris or s:fr:Foo ... this will be a bit involved but can be done. However, this will break HTML -> HTML roundtripping. So, (assuming we are on enwiki), http://fr.wikivoyage.org/wiki/Paris will become [[voy:fr:Paris|Paris]] and on parse, this will generate http://en.wikivoyage.org/wiki/fr:Paris which is a different url compared to what we started with. This is a subtle change, but we could update our testing to normalize for this perhaps.

How important is this functionality?