Page MenuHomePhabricator

Wikilinks are converted the wrong way
Closed, DeclinedPublic

Description

A bug report from https://de.wikipedia.org/wiki/Wikipedia_Diskussion:Technische_W%C3%BCnsche/Topw%C3%BCnsche/Verschieben_von_Dateien_nach_Commons#Falsch_formatierte_Wikilinks

Wikilinks are often converted the wrong way. The file [[File:Accent Grave.svg]] for instance is converted like so during the transfer to Commons:

[[Accent Grave]] → [[:w:de:Accent Grave]]
[[Benutzer:Carport]] → [[:w:de:User:Carport]]

A pipe character before the closing double bracket would help.
:w is superfluous.

Desired result:
[[Accent Grave]] → [[:de:Accent Grave|Accent Grave]]

Event Timeline

thiemowmde subscribed.

Sorry, but this is all working as intended.

  • The extra : is needed to disable the magic behavior of interlanguage links and such. Technically it might be possible to differentiate and skip the : sometimes. But that's not as easy as it might sound – for not much benefit. Still patch-welcome if somebody wants to work on this.
  • For the same reason the "two-hop" w:de: is done. There is technically no guarantee that de: points to Wikipedia and not, for example, the German Wikisource. Keep in mind that FileImporter is designed to run on other wikis as well, not only on Commons.
  • Manipulating the wikitext further by adding | is not necessary to make the link work. Doing so would also hide the fact that the link points to another wiki.

Generally the idea is to focus on wikitext conversions that are special to FileImporter and hard or impossible to do after the file is on Commons. General wikitext cleanup is better done by community-maintained tools. See e.g. https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Check_Wikipedia.