43 return WikitextContent::class;
59 $services = MediaWikiServices::getInstance();
65 ->getLanguageNameUtils()
66 ->getLanguageName( $iw,
67 LanguageNameUtils::AUTONYMS,
68 LanguageNameUtils::DEFINED )
74 $mwRedir = $services->getMagicWordFactory()->get(
'redirect' );
75 $redirectText = $mwRedir->getSynonym( 0 ) .
76 ' [[' . $optionalColon . $destination->
getFullText() .
']]';
79 $redirectText .=
"\n" . $text;
83 return new $class( $redirectText );
130 $fields = parent::getFieldsForSearchIndex( $engine );
134 $fields[
'heading']->setFlag( SearchIndexField::FLAG_SCORING );
136 $fields[
'auxiliary_text'] =
139 $fields[
'opening_text'] =
141 $fields[
'opening_text']->setFlag(
142 SearchIndexField::FLAG_SCORING | SearchIndexField::FLAG_NO_HIGHLIGHT
155 $fields = parent::getDataForSearchIndex( $page, $parserOutput, $engine );
158 $fields[
'heading'] = $structure->headings();
160 $fields[
'opening_text'] = $structure->getOpeningText();
161 $fields[
'text'] = $structure->getMainText();
162 $fields[
'auxiliary_text'] = $structure->getAuxiliaryText();
163 $fields[
'defaultsort'] = $structure->getDefaultSort();
167 $fields = array_merge( $fields,
187 return $content->getMessage()->plain();
190 return parent::serializeContent(
$content, $format );
202 if ( $shouldCallDeprecatedMethod ) {
209 '@phan-var WikitextContent $content';
213 $parser = MediaWikiServices::getInstance()->getParser();
214 $pst = $parser->preSaveTransform(
221 if ( $text === $pst ) {
226 $ret =
new $contentClass( $pst );
227 $ret->setPreSaveTransformFlags( $parser->getOutput()->getAllFlags() );
244 $shouldCallDeprecatedMethod = $this->shouldCallDeprecatedContentTransformMethod(
249 if ( $shouldCallDeprecatedMethod ) {
250 return $this->callDeprecatedContentPLT(
256 '@phan-var WikitextContent $content';
259 $plt = MediaWikiServices::getInstance()->getParser()->getPreloadText(
266 $contentClass = $this->getContentClass();
267 return new $contentClass( $plt );
const CONTENT_MODEL_WIKITEXT
const CONTENT_FORMAT_WIKITEXT
Wikitext.
checkFormat( $format)
Convenient for checking whether a format provided as a parameter is actually supported.
shouldCallDeprecatedContentTransformMethod(Content $content, $params)
Check if we need to provide content overrides deprecated Content method.
callDeprecatedContentPST(Content $content, PreSaveTransformParams $params)
Provided content overrides deprecated Content::preSaveTransform, call it and return.
Content handler for File: files TODO: this handler s not used directly now, but instead manually call...
Wrapper allowing us to handle a system message as a Content object.
Contain a class for special pages.
makeSearchFieldMapping( $name, $type)
Create a search field definition.
Base content handler implementation for flat text contents.
Represents a title within MediaWiki.
getNamespace()
Get the namespace index, i.e.
getFullText()
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
getInterwiki()
Get the interwiki prefix.
Class representing a MediaWiki article and history.
getTitle()
Get the title object of the article.
Class allowing to explore structure of parsed wikitext.
Content handler for wiki text pages.
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
getContentClass()
Returns the name of the associated Content class, to be used when creating new objects.
supportsRedirects()
Returns true because wikitext supports redirects.
preloadTransform(Content $content, PreloadTransformParams $pltParams)
Returns a Content object with preload transformations applied (or this object if no transformations a...
getFieldsForSearchIndex(SearchEngine $engine)
Get fields definition for search index.
makeRedirectContent(Title $destination, $text='')
Returns a WikitextContent object representing a redirect to the given destination page.
isParserCacheSupported()
Returns true, because wikitext supports caching using the ParserCache mechanism.
__construct( $modelId=CONTENT_MODEL_WIKITEXT)
serializeContent(Content $content, $format=null)
Returns the content's text as-is.
supportsSections()
Returns true because wikitext supports sections.
getDataForSearchIndex(WikiPage $page, ParserOutput $parserOutput, SearchEngine $engine)
Return fields to be indexed by search engine as representation of this document.
Base interface for content objects.