$section = str_replace( '[[', '', $section );
$section = str_replace( ']]', '', $section );
+ // We don't want any links in the auto text to be linked, but we still
+ // want to show any [[ ]]
+ $sectionText = str_replace( '[[', '[[', $auto );
+
$section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
if ( $local ) {
$sectionTitle = Title::makeTitleSafe( NS_MAIN, '', $section );
}
if ( $sectionTitle ) {
$auto = Linker::makeCommentLink(
- $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $auto,
+ $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText,
$wikiId, 'noclasses'
);
}
<span dir="auto"><span class="autocomment"><a href="#External_links">→External links</a>: </span> removed bogus entries</span>
!!end
+!! test
+Edit comment with section link that has a link in it
+!! options
+comment local title=[[Main Page]]
+!! wikitext
+/* [[A link]] */
+!! html/php
+<span dir="auto"><span class="autocomment"><a href="#A_link">→[[A link]]</a></span></span>
+!! end
+
+!! test
+Edit comment with section link that has a template in it
+!! options
+comment local title=[[Main Page]]
+!! wikitext
+/* {{foobar|param}} */
+!! html/php
+<span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→{{foobar|param}}</a></span></span>
+!! end
+
!! test
Edit comment with subpage link (T16080)
!! options
"/* autocomment */",
],
[
- '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#linkie.3F" title="Special:BlankPage">→<a href="/wiki/index.php?title=Linkie%3F&action=edit&redlink=1" class="new" title="Linkie? (page does not exist)">linkie?</a></a></span></span>',
+ '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#linkie.3F" title="Special:BlankPage">→[[linkie?]]</a></span></span>',
"/* [[linkie?]] */",
],
[