merged latest master
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index dbcd43c..72808e0 100644 (file)
@@ -189,7 +189,7 @@ class ApiParse extends ApiBase {
                                return;
                        }
                        // Not cached (save or load)
-                       $p_result = $wgParser->parse( $params['pst'] ? $this->pstText : $this->text, $titleObj, $popts );
+                       $p_result = $wgParser->parse( $params['pst'] ? $this->pstText : $this->text, $titleObj, $popts ); #FIXME: use Content object¡
                }
 
                $result_array = array();
@@ -322,9 +322,9 @@ class ApiParse extends ApiBase {
 
                $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() );
+                                       ? 'page id ' . $pageId : $titleObj->getText() ); #FIXME: get section...
 
                        // Not cached (save or load)
                        return $wgParser->parse( $this->text, $titleObj, $popts );
@@ -336,13 +336,14 @@ class ApiParse extends ApiBase {
                                $this->dieUsage( "There is no revision ID {$page->getLatest()}", 'missingrev' );
                        }
                        if ( $getWikitext ) {
-                               $this->text = $page->getRawText();
+                $this->content = $page->getContent( Revision::RAW ); #FIXME: use $this->content everywhere
+                               $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 );