Page MenuHomePhabricator

Parser's stripSectionName should get the same text as Linker::normalizeSubpageLink for a [[/Subpage/]] link in the summary
Open, MediumPublic

Description

Compare the default summary of an edit on sections of [[Wikipedia:Sandbox/Subpage]] with the following headers:

(1) == [[Wikipedia:Sandbox/Subpage|Subpage]] ==
https://secure.wikimedia.org/wikipedia/en/w/index.php?diff=441724658&oldid=441724577

(2) == /Subpage/ ==
https://secure.wikimedia.org/wikipedia/en/w/index.php?diff=441724701&oldid=441724658

The autosummaries were the following in each case:
(1) /* Subpage */
(2) /* /Subpage/ */

The second one is wrong and should be equals to the first one, just as happens with the displayed text of the corresponding links.


Version: unspecified
Severity: normal

Details

Reference
bz30084

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:52 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz30084.
bzimport added a subscriber: Unknown Object (MLST).

FYI: The symptoms are the same of Bug 28055. Maybe this can be fixed similarly.

On current version of MW (downloaded from git), the text of the autosummary produced by $wgParser->stripSectionName[1] is still inconsistent with the text of the subpage links created by Linker::normalizeSubpageLink[2], because the capturing group of the regex
/\[\[:?([^[]+)\|?\]\]/
matches "/Subpage/" in the text "/Subpage/".[3]

Maybe it should be changed to
/\[\[:?\/?([^\[]+?)\/?\|?\]\]/
per example at [4].

[1] https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/parser/Parser.php;h=0f22755e0921fa9ba38d9636999ef7b831dee816;hb=HEAD#l5675

[2] https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/Linker.php;h=05a9905669f95fcb573f851da6d58bad8a340161;hb=HEAD#l1471

[3] http://www.rubular.com/r/lVQGMcZKGA
[4] http://www.rubular.com/r/2ckz5UIDBb