Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -7515,17 +7515,6 @@ |
7516 | 7516 | <a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">#section</a> |
7517 | 7517 | !! end |
7518 | 7518 | |
7519 | | -!! test |
7520 | | -Edit comment with mismatched brackets (bug 15745) |
7521 | | -!! options |
7522 | | -comment |
7523 | | -title=[[Main Page]] |
7524 | | -!!input |
7525 | | -Some text, a [[broken link|bad and a [[good link|good]] |
7526 | | -!! result |
7527 | | -Some text, a [[broken link|bad and a <a href="https://www.mediawiki.org/index.php?title=Good_link&action=edit&redlink=1" class="new" title="Good link (page does not exist)">good</a> |
7528 | | -!! end |
7529 | | - |
7530 | 7519 | TODO: |
7531 | 7520 | more images |
7532 | 7521 | more tables |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1012,22 +1012,10 @@ |
1013 | 1013 | public function formatLinksInComment( $comment, $title = null, $local = false ) { |
1014 | 1014 | $this->commentContextTitle = $title; |
1015 | 1015 | $this->commentLocal = $local; |
1016 | | - # Borrowed from Parser::replaceInternalLinks2 |
1017 | | - $parts = StringUtils::explode( '[[', ' ' . $comment ); |
1018 | | - $start = $parts->current(); |
1019 | | - $parts->next(); |
1020 | | - $line = $parts->current(); |
1021 | | - $html = substr( $start, 1 ); |
1022 | | - for ( ; $line !== false && $line !== null ; $parts->next(), $line = $parts->current() ) { |
1023 | | - $linked = preg_replace_callback( |
1024 | | - '/^:?(.*?)(\|(.*?))*\]\]([^[]*)/', |
1025 | | - array( $this, 'formatLinksInCommentCallback' ), |
1026 | | - $line, -1, $count ); |
1027 | | - if( !$count ) { // No valid link found, put the brackets back |
1028 | | - $linked = '[[' . $linked; |
1029 | | - } |
1030 | | - $html .= $linked; |
1031 | | - } |
| 1016 | + $html = preg_replace_callback( |
| 1017 | + '/\[\[:?(.*?)(\|(.*?))*\]\]([^[]*)/', |
| 1018 | + array( $this, 'formatLinksInCommentCallback' ), |
| 1019 | + $comment ); |
1032 | 1020 | unset( $this->commentContextTitle ); |
1033 | 1021 | unset( $this->commentLocal ); |
1034 | 1022 | return $html; |
— | — | @@ -1056,7 +1044,7 @@ |
1057 | 1045 | $thelink = null; |
1058 | 1046 | if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) { |
1059 | 1047 | # Media link; trail not supported. |
1060 | | - $linkRegexp = '/^(.*?)\]\]/'; |
| 1048 | + $linkRegexp = '/\[\[(.*?)\]\]/'; |
1061 | 1049 | $title = Title::makeTitleSafe( NS_FILE, $submatch[1] ); |
1062 | 1050 | $thelink = $this->makeMediaLinkObj( $title, $text ); |
1063 | 1051 | } else { |
— | — | @@ -1066,7 +1054,7 @@ |
1067 | 1055 | } else { |
1068 | 1056 | $trail = ""; |
1069 | 1057 | } |
1070 | | - $linkRegexp = '/^(.*?)\]\]' . preg_quote( $trail, '/' ) . '/'; |
| 1058 | + $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/'; |
1071 | 1059 | if (isset($match[1][0]) && $match[1][0] == ':') |
1072 | 1060 | $match[1] = substr($match[1], 1); |
1073 | 1061 | list( $inside, $trail ) = Linker::splitTrail( $trail ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -348,8 +348,6 @@ |
349 | 349 | * (bug 17374) Special:Export no longer exports multiple copies of pages |
350 | 350 | * (bug 19818) Edits to user CSS/JS subpages can now be marked as patrolled by |
351 | 351 | users who can't edit them |
352 | | -* (bug 15745) The edit summary link parser now handles mismatched brackets |
353 | | - better |
354 | 352 | * (bug 19839) Comments in log items are no more double escaped |
355 | 353 | * (bug 18161) Fix inconsistent separators in watchlist link toolbars with |
356 | 354 | "enhanced recent changes" |