Page MenuHomePhabricator

Prettify URLs in API/FormatHTML only works on Wikipedia links
Closed, ResolvedPublic

Description

The method prettifyUrls in api/FormatHtml.php tries to match the following RegEx:

'/(https?:)?\/\/((\w+)\.wikipedia\.org\/w\/index\.php\?title=(.*)&oldid=(.*))/

But since T131344 we now support other sites than Wikipedia. For ru: we are getting from Wikivoyage, resulting in links like //ru.wikipedia.org/w/index.php?title=Title&oldid=162698 which do not match

Event Timeline

@Lokal_Profil, shall we keep this as an Easy task?

Yes this should be fairly easy (at least if you know regexp)

Change 286156 had a related patch set uploaded (by Lokal Profil):
[NOT TESTED] Better support for sister projects

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

Change 286156 only deals with part of this issue. To test THAT change

  • Go to this link and ensure that the title is now a link to ru.wiktionary.
  • Then go to this link and ensure <link> no longer mentions wikipedia.

Change 286156 merged by jenkins-bot:
[NOT FULLY TESTED] Better support for sister projects

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

Change 286798 had a related patch set uploaded (by Lokal Profil):
Support non-Wikipedia projects in pretty urls

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

To test 286798 this link should have a nicely formated link (similar to this one).

Change 286798 merged by jenkins-bot:
Support non-Wikipedia projects in pretty urls

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