Don't link wikilinks in section heading autocomments
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 1 Dec 2018 09:19:33 +0000 (01:19 -0800)
committerKunal Mehta <legoktm@member.fsf.org>
Mon, 3 Dec 2018 20:43:03 +0000 (12:43 -0800)
commit1706d353ae33e3bf24ff631213c39914c5fdf621
treeaef1f259b39ecfd753f068160b12cd67f9d3b857
parent0c9cf24b056bcdf466fe03807d13785c24993c72
Don't link wikilinks in section heading autocomments

Previously, a manually constructed autocomment in the form of
/* [[Some link]] */

would create a link to the the section, and then the "Some link" page.

After T165189 was implemented, the entire autocomment is now a link to
the section, so we're creating links inside of a link...which is
problematic. In most contexts (history and watchlist particularly), the
section link is more important than the title in the section heading, so
that's what we'll favor here.

It's worth noting that this situation is a manually created edge case.
Even if the section heading is a wikilink, the edit summary will
autofill a section autocomment without the double brackets.

We'll now render the double brackets ([[...]]) and not link them. This
is what the user literally typed, and matches the existing practice of
rendering templates in section headings with their literal syntax. And
as a bonus, it's still possible for user scripts such as wikEdDiff to
turn the rendered double brackets into a real link if users want.

Bug: T165189
Change-Id: Ib10679edd76c72a60d7e1c89fc8454166e34c463
includes/Linker.php
tests/parser/parserTests.txt
tests/phpunit/includes/LinkerTest.php