Index: trunk/extensions/CodeReview/SpecialCode.php |
— | — | @@ -171,12 +171,21 @@ |
172 | 172 | } |
173 | 173 | |
174 | 174 | function link( $text ) { |
| 175 | + # Catch links like http://www.mediawiki.org/wiki/Special:Code/MediaWiki/44245#c829 |
| 176 | + # Ended by space or brackets (like those pesky <br/> tags) |
| 177 | + $text = preg_replace_callback( '/(\b)('.wfUrlProtocols().')([^ <>]+)(\b)/', array( $this, 'generalLink' ), $text ); |
175 | 178 | $text = preg_replace_callback( '/\br(\d+)\b/', array( $this, 'messageRevLink' ), $text ); |
176 | 179 | $text = preg_replace_callback( '/\bbug #?(\d+)\b/i', array( $this, 'messageBugLink' ), $text ); |
177 | 180 | return $text; |
178 | 181 | } |
| 182 | + |
| 183 | + function generalLink( $arr ) { |
| 184 | + $url = $arr[2] . $arr[3]; |
| 185 | + // Re-add the surrounding space/punctuation |
| 186 | + return $arr[1] . $this->makeExternalLink( $url, $url ). $arr[4]; |
| 187 | + } |
179 | 188 | |
180 | | - function messageBugLink( $arr ){ |
| 189 | + function messageBugLink( $arr ) { |
181 | 190 | $text = $arr[0]; |
182 | 191 | $bugNo = intval( $arr[1] ); |
183 | 192 | $url = $this->mRepo->getBugPath( $bugNo ); |