diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-11-30 05:40:20 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-11-30 05:40:20 +0100 |
commit | 8a1f9ada65d746b630c96b184000f3f0bf6cf34d (patch) | |
tree | f641d0e874d1ac6a04c30e2e8a112fb1c4ceb6bd /includes/Linker.php | |
parent | 9498a3d2852ace0f4ee23598f542dbce3fd2ec28 (diff) |
Update to MediaWiki 1.19.3
Diffstat (limited to 'includes/Linker.php')
-rw-r--r-- | includes/Linker.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/includes/Linker.php b/includes/Linker.php index 0b813ac0..575f2841 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1213,7 +1213,18 @@ class Linker { self::$commentContextTitle = $title; self::$commentLocal = $local; $html = preg_replace_callback( - '/\[\[:?(.*?)(\|(.*?))*\]\]([^[]*)/', + '/ + \[\[ + :? # ignore optional leading colon + ([^\]|]+) # 1. link target; page names cannot include ] or | + (?:\| + # 2. a pipe-separated substring; only the last is captured + # Stop matching at | and ]] without relying on backtracking. + ((?:]?[^\]|])*+) + )* + \]\] + ([^[]*) # 3. link trail (the text up until the next link) + /x', array( 'Linker', 'formatLinksInCommentCallback' ), $comment ); self::$commentContextTitle = null; @@ -1239,8 +1250,8 @@ class Linker { } # Handle link renaming [[foo|text]] will show link as "text" - if ( $match[3] != "" ) { - $text = $match[3]; + if ( $match[2] != "" ) { + $text = $match[2]; } else { $text = $match[1]; } @@ -1255,7 +1266,7 @@ class Linker { } } else { # Other kind of link - if ( preg_match( $wgContLang->linkTrail(), $match[4], $submatch ) ) { + if ( preg_match( $wgContLang->linkTrail(), $match[3], $submatch ) ) { $trail = $submatch[1]; } else { $trail = ""; |