Add comments to Linker::formatLinksInComment()
Per Tim Starling's suggestion, added comments to the regex in Linker::formatLinksInComment(). Change-Id: If85567e5a2e57dd56f5f263f3512e9ed2f9c940c
This commit is contained in:
parent
3a751a39b1
commit
a80bc92245
1 changed files with 12 additions and 1 deletions
|
|
@ -1376,7 +1376,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue