Merge "Add tablesUsed to RevisionStoreDbTest"
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index 15b94fb..2839ab9 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Created on Dec 01, 2007
- *
  * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
@@ -288,10 +286,6 @@ class ApiParse extends ApiBase {
                        $result_array['textsuppressed'] = true;
                }
 
-               if ( $params['disabletoc'] ) {
-                       $p_result->setTOCEnabled( false );
-               }
-
                if ( isset( $params['useskin'] ) ) {
                        $factory = MediaWikiServices::getInstance()->getSkinFactory();
                        $skin = $factory->makeSkin( Skin::normalizeKey( $params['useskin'] ) );
@@ -347,7 +341,11 @@ class ApiParse extends ApiBase {
                }
 
                if ( isset( $prop['text'] ) ) {
-                       $result_array['text'] = $p_result->getText();
+                       $result_array['text'] = $p_result->getText( [
+                               'allowTOC' => !$params['disabletoc'],
+                               'enableSectionEditLinks' => !$params['disableeditsection'],
+                               'unwrap' => $params['wrapoutputclass'] === '',
+                       ] );
                        $result_array[ApiResult::META_BC_SUBELEMENTS][] = 'text';
                }
 
@@ -541,9 +539,9 @@ class ApiParse extends ApiBase {
                if ( $params['disabletidy'] ) {
                        $popts->setTidy( false );
                }
-               $popts->setWrapOutputClass(
-                       $params['wrapoutputclass'] === '' ? false : $params['wrapoutputclass']
-               );
+               if ( $params['wrapoutputclass'] !== '' ) {
+                       $popts->setWrapOutputClass( $params['wrapoutputclass'] );
+               }
 
                $reset = null;
                $suppressCache = false;