public static function parseWikiLinks( $text, $articlePath ) {
		self::$articlePath = $articlePath;

		return preg_replace_callback(
			'/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/',
			function ( array $bits ) {
				if ( !isset( $bits[2] ) || $bits[2] == '' ) {
					$bits[2] = strtr( $bits[1], '_', ' ' );
				}

				$article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8' );

				return '<a href="' . htmlspecialchars(
					self::prettyEncodedWikiUrl( self::$articlePath, $article ), ENT_COMPAT, 'UTF-8'
				) . '">' . $bits[2] . "</a>";
			},
			$text
		);
	}