*/
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
+use Wikimedia\ScopedCallback;
/**
* @defgroup Parser Parser
$keyword = 'RFC';
$urlmsg = 'rfcurl';
$cssClass = 'mw-magiclink-rfc';
+ $trackingCat = 'magiclink-tracking-rfc';
$id = $m[5];
} elseif ( substr( $m[0], 0, 4 ) === 'PMID' ) {
if ( !$this->mOptions->getMagicPMIDLinks() ) {
$keyword = 'PMID';
$urlmsg = 'pubmedurl';
$cssClass = 'mw-magiclink-pmid';
+ $trackingCat = 'magiclink-tracking-pmid';
$id = $m[5];
} else {
throw new MWException( __METHOD__ . ': unrecognised match type "' .
substr( $m[0], 0, 20 ) . '"' );
}
$url = wfMessage( $urlmsg, $id )->inContentLanguage()->text();
+ $this->addTrackingCategory( $trackingCat );
return Linker::makeExternalLink( $url, "{$keyword} {$id}", true, $cssClass, [], $this->mTitle );
} elseif ( isset( $m[6] ) && $m[6] !== ''
&& $this->mOptions->getMagicISBNLinks()
' ' => '',
'x' => 'X',
] );
+ $this->addTrackingCategory( 'magiclink-tracking-isbn' );
return $this->getLinkRenderer()->makeKnownLink(
SpecialPage::getTitleFor( 'Booksources', $num ),
"ISBN $isbn",
return $attrText;
}
+ // We can't safely check if the expansion for $content resulted in an
+ // error, because the content could happen to be the error string
+ // (T149622).
$content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] );
- if ( substr( $content, 0, $errorLen ) === $errorStr ) {
- // See above
- return $content;
- }
$marker = self::MARKER_PREFIX . "-$name-"
. sprintf( '%08X', $this->mMarkerIndex++ ) . self::MARKER_SUFFIX;