checkFormat( $format ); return new WikitextContent( $text ); } /** * @see ContentHandler::makeEmptyContent * * @return Content */ public function makeEmptyContent() { return new WikitextContent( '' ); } /** * Returns a WikitextContent object representing a redirect to the given destination page. * * @see ContentHandler::makeRedirectContent * * @param Title $destination the page to redirect to. * @param string $text text to include in the redirect, if possible. * * @return Content */ public function makeRedirectContent( Title $destination, $text = '' ) { $optionalColon = ''; if ( $destination->getNamespace() == NS_CATEGORY ) { $optionalColon = ':'; } else { $iw = $destination->getInterwiki(); if ( $iw && Language::fetchLanguageName( $iw, null, 'mw' ) ) { $optionalColon = ':'; } } $mwRedir = MagicWord::get( 'redirect' ); $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $optionalColon . $destination->getFullText() . ']]'; if ( $text != '' ) { $redirectText .= "\n" . $text; } return new WikitextContent( $redirectText ); } /** * Returns true because wikitext supports redirects. * * @see ContentHandler::supportsRedirects * * @return boolean whether redirects are supported. */ public function supportsRedirects() { return true; } /** * Returns true because wikitext supports sections. * * @return boolean whether sections are supported. */ public function supportsSections() { return true; } /** * Returns true, because wikitext supports caching using the * ParserCache mechanism. * * @since 1.21 * @return bool */ public function isParserCacheSupported() { return true; } }