}
$content = $this->mArticle->getContentObject();
- return $content->getNativeData(); # this editor is for editing the raw text. so use the raw text.
+ return ContentHandler::getContentText( $content ); # this editor is for editing the raw text. so use the raw text.
}
/**
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
if ( $this->mTitle->exists() ) {
- $text = $this->getNativeData();
+ $text = $this->getNativeData(); #FIXME: may not be a string. check Content model!
} else {
$text = false;
}
$isminor = ( $flags & EDIT_MINOR ) && $user->isAllowed( 'minoredit' );
$bot = $flags & EDIT_FORCE_BOT;
- $oldtext = $this->getNativeData(); // current revision
+ $oldtext = $this->getNativeData(); // current revision #FIXME: may not be a string. check Content model!
$oldsize = strlen( $oldtext );
$oldid = $this->getLatest();
$oldIsRedirect = $this->isRedirect();
$text = '';
} else {
$content = $articleObj->getContentObject();
- $text = $content->getNativeData();
+ $text = ContentHandler::getContentText( $content ); #FIXME: serialize?! get format from params?...
}
if ( !is_null( $params['section'] ) ) {
// Process the content for section edits
$section = intval( $params['section'] );
- $text = $content->getSection( $section, false );
+ $sectionContent = $content->getSection( $section );
+ $text = ContentHandler::getContentText( $sectionContent ); #FIXME: serialize?! get format from params?...
if ( $text === false || $text === null ) {
$this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
}
$page = WikiPage::factory( $titleObj );
- if ( $this->section !== false ) {
+ if ( $this->section !== false ) { #FIXME: get section Content, get parser output, ...
$this->text = $this->getSectionText( $page->getRawText(), !is_null( $pageId )
? 'page id ' . $pageId : $titleObj->getText() ); #FIXME: get section...
$pout = $page->getParserOutput( $popts );
if ( $getWikitext ) {
$this->content = $page->getContent( Revision::RAW ); #FIXME: use $this->content everywhere
- $this->text = $this->content->getNativeData(); #FIXME: change $this->text to $this->data?!
+ $this->text = ContentHandler::getContentText( $this->content ); #FIXME: serialize, get format from params; or use object structure in result?
}
return $pout;
}
}
- private function getSectionText( $text, $what ) {
+ private function getSectionText( $text, $what ) { #FIXME: replace with Content::getSection
global $wgParser;
// Not cached (save or load)
$text = $wgParser->getSection( $text, $this->section, false );