Page MenuHomePhabricator

wiki link contained in index page are mishandled if they contain a ":"
Closed, ResolvedPublic

Description

Proofreadpage extension build a list of wiki link contained in an index page to be able to produce prev/next links. If an index called "foo.djvu" contains links [[A]], [[B]] and [[C]] in this order, and the tag <pages index="oo.djvu" is used on page B, the extension know the previous and next link and can create navigation links.

This is handled in Proofreadpage.body.php:parse_index_links() but title are parsed with a simple regexp $text_links_pattern = "/\[\[\s*([^:\|]*?)\s*(\|(.*?)|)\]\]/i"; the [^:\|] is needed because we want only link to main but it filter too much links, all title with a ":" are removed from the list.

Tpt suggested on IRC to use Title::newFromText then filter with ->inNamespace( NS_MAIN ). As a side effect it'll also normalize title, actually a title in index like [[Foo_bar]] or [[foo bar]] is not recognized as the same title as "Foo bar".


Version: master
Severity: normal

Details

Reference
bz47011