Page MenuHomePhabricator

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


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



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:21 AM
bzimport added a project: ProofreadPage.
bzimport set Reference to bz47011.
bzimport added a subscriber: Unknown Object (MLST).
Phe created this task.Apr 8 2013, 12:10 PM

Related URL: (Gerrit Change I2cbd16ab182e74b43401e3f9d692d48d717fa860) (Gerrit Change I2cbd16ab182e74b43401e3f9d692d48d717fa860) | change APPROVED and MERGED [by jenkins-bot]

GOIII moved this task from Backlog to Done on the ProofreadPage board.Jun 12 2016, 3:46 AM