Bug: T180159
Change-Id: Ic9dbb8ef3948fe751d16c3963769b616b5db2fc7
$maxId = $newKey > $maxId ? $newKey : $maxId;
}
}
$maxId = $newKey > $maxId ? $newKey : $maxId;
}
}
- $texts = preg_replace_callback( '/(<!--LINK \d+:)(\d+)(-->)/',
+ $texts = preg_replace_callback( '/(<!--LINK\'" \d+:)(\d+)(-->)/',
[ $this, 'mergeForeignCallback' ], $texts );
# Renumber interwiki links
[ $this, 'mergeForeignCallback' ], $texts );
# Renumber interwiki links
$this->interwikis[$newKey] = $entry;
$maxId = $newKey > $maxId ? $newKey : $maxId;
}
$this->interwikis[$newKey] = $entry;
$maxId = $newKey > $maxId ? $newKey : $maxId;
}
- $texts = preg_replace_callback( '/(<!--IWLINK )(\d+)(-->)/',
+ $texts = preg_replace_callback( '/(<!--IWLINK\'" )(\d+)(-->)/',
[ $this, 'mergeForeignCallback' ], $texts );
# Set the parent link ID to be beyond the highest used ID
[ $this, 'mergeForeignCallback' ], $texts );
# Set the parent link ID to be beyond the highest used ID
# Internal links
$pos = 0;
while ( $pos < strlen( $text ) ) {
# Internal links
$pos = 0;
while ( $pos < strlen( $text ) ) {
- if ( !preg_match( '/<!--LINK (\d+):(\d+)-->/',
+ if ( !preg_match( '/<!--LINK\'" (\d+):(\d+)-->/',
$text, $m, PREG_OFFSET_CAPTURE, $pos )
) {
break;
$text, $m, PREG_OFFSET_CAPTURE, $pos )
) {
break;
# Interwiki links
$pos = 0;
while ( $pos < strlen( $text ) ) {
# Interwiki links
$pos = 0;
while ( $pos < strlen( $text ) ) {
- if ( !preg_match( '/<!--IWLINK (\d+)-->/', $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
+ if ( !preg_match( '/<!--IWLINK\'" (\d+)-->/', $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
break;
}
$key = $m[1][0];
break;
}
$key = $m[1][0];
// Use a globally unique ID to keep the objects mergable
$key = $this->parent->nextLinkID();
$this->interwikis[$key] = $entry;
// Use a globally unique ID to keep the objects mergable
$key = $this->parent->nextLinkID();
$this->interwikis[$key] = $entry;
- $retVal = "<!--IWLINK $key-->{$trail}";
+ $retVal = "<!--IWLINK'\" $key-->{$trail}";
} else {
$key = $this->parent->nextLinkID();
$ns = $nt->getNamespace();
$this->internals[$ns][$key] = $entry;
} else {
$key = $this->parent->nextLinkID();
$ns = $nt->getNamespace();
$this->internals[$ns][$key] = $entry;
- $retVal = "<!--LINK $ns:$key-->{$trail}";
+ $retVal = "<!--LINK'\" $ns:$key-->{$trail}";
$title = $entry['title'];
$query = isset( $entry['query'] ) ? $entry['query'] : [];
$key = "$ns:$index";
$title = $entry['title'];
$query = isset( $entry['query'] ) ? $entry['query'] : [];
$key = "$ns:$index";
- $searchkey = "<!--LINK $key-->";
+ $searchkey = "<!--LINK'\" $key-->";
$displayText = $entry['text'];
if ( isset( $entry['selflink'] ) ) {
$replacePairs[$searchkey] = Linker::makeSelfLinkObj( $title, $displayText, $query );
$displayText = $entry['text'];
if ( isset( $entry['selflink'] ) ) {
$replacePairs[$searchkey] = Linker::makeSelfLinkObj( $title, $displayText, $query );
# Do the thing
$text = preg_replace_callback(
# Do the thing
$text = preg_replace_callback(
+ '/(<!--LINK\'" .*?-->)/',
$replacer->cb(),
$text
);
$replacer->cb(),
$text
);
$replacer = new HashtableReplacer( $replacePairs, 1 );
$text = preg_replace_callback(
$replacer = new HashtableReplacer( $replacePairs, 1 );
$text = preg_replace_callback(
- '/<!--IWLINK (.*?)-->/',
+ '/<!--IWLINK\'" (.*?)-->/',
$replacer->cb(),
$text );
}
$replacer->cb(),
$text );
}
*/
public function replaceText( $text ) {
$text = preg_replace_callback(
*/
public function replaceText( $text ) {
$text = preg_replace_callback(
- '/<!--(LINK|IWLINK) (.*?)-->/',
+ '/<!--(LINK|IWLINK)\'" (.*?)-->/',
[ $this, 'replaceTextCallback' ],
$text );
[ $this, 'replaceTextCallback' ],
$text );
$this->mForceTocPosition = true;
# Set a placeholder. At the end we'll fill it in with the TOC.
$this->mForceTocPosition = true;
# Set a placeholder. At the end we'll fill it in with the TOC.
- $text = $mw->replace( '<!--MWTOC-->', $text, 1 );
+ $text = $mw->replace( '<!--MWTOC\'"-->', $text, 1 );
# Only keep the first one.
$text = $mw->replace( '', $text );
# Only keep the first one.
$text = $mw->replace( '', $text );
$full .= implode( '', $sections );
if ( $this->mForceTocPosition ) {
$full .= implode( '', $sections );
if ( $this->mForceTocPosition ) {
- return str_replace( '<!--MWTOC-->', $toc, $full );
+ return str_replace( '<!--MWTOC\'"-->', $toc, $full );