Page MenuHomePhabricator

Recognize interwiki and language links
Closed, ResolvedPublic


Currently Parsoid does not recognize interwiki / language links and just treats them as regular wiki links.

The most important part of this for the December release is the recognition of language links, which are normally rendered as 'Languages' in the sidebar.

To this end, the prefix of a wiki link processed in the LinkHandler (js/lib/ext.core.LinkHandler.js) needs to be matched against a regexp of interwiki prefixes. We already have such a regexp available in the environment as env.interwikiRegexp, which should be reachable as this.manager.env.interwikiRegexp inside the link handler.

For recognized interwiki links ([[de:Foo]] for example), no link should be rendered and something like <link rel="mw:WikiLink/Language" href="de:Foo"> should be produced instead. This also needs to be round-tripped, which will require a small tweak in the serializer. Please ask in #mediawiki-parsoid when you get to this stage.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:09 AM
bzimport set Reference to bz42160.

Now merged, so language links are supported. Interwiki links left to do.

We still need to separate interwiki from language links. Language links are like interwiki prefixes ([[en:Foo]] for example), but are listed in the 'this article in other languages' section on the left. Plain interwiki links on the other hand always render inline, but link to an external resource with the base HTTP URL corresponding to the interwiki prefix.

Interwiki prefixes and languages are returned separately from the API:|languages

So, steps to implement this would be:

  • Add support for interwiki prefixes and languages in WikiConfig (lib/mediawiki.WikiConfig.js).
  • Add support for these types in the WikitextSerializer and make sure that these links round-trip properly.

Work in progress by Jan Christiansen on language and interwiki links in and is merged, fixing this bug. Basic editing support is there too, but needs testing and possibly tweaks.

Thanks Jan for implementing this!!