API: allow disabling TOC in action=parse
authorMax Semenik <maxsem.wiki@gmail.com>
Tue, 17 Dec 2013 22:31:17 +0000 (02:31 +0400)
committerMax Semenik <maxsem.wiki@gmail.com>
Tue, 17 Dec 2013 22:31:17 +0000 (02:31 +0400)
Change-Id: If9652bbae97ce40c8695affeb28be6088949dfd2

RELEASE-NOTES-1.23
includes/api/ApiParse.php

index 3e77434..783ca3c 100644 (file)
@@ -82,6 +82,7 @@ production.
 * EditPage::spamPage() was deprecated since 1.17 and has been removed.
 * action=parse&prop=languageshtml was deprecated in 1.18 and will be removed in
   MediaWiki 1.24.
+* action=parse now has disabletoc flag to disable table of contents in output.
 
 === Languages updated in 1.23===
 
index 88904c0..a323aad 100644 (file)
@@ -249,6 +249,10 @@ class ApiParse extends ApiBase {
                        $result_array['redirects'] = $redirValues;
                }
 
+               if ( $params['disabletoc'] ) {
+                       $p_result->setTOCEnabled( false );
+               }
+
                if ( isset( $prop['text'] ) ) {
                        $result_array['text'] = array();
                        ApiResult::setContent( $result_array['text'], $p_result->getText() );
@@ -691,6 +695,7 @@ class ApiParse extends ApiBase {
                        'generatexml' => false,
                        'preview' => false,
                        'sectionpreview' => false,
+                       'disabletoc' => false,
                        'contentformat' => array(
                                ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
                        ),
@@ -753,6 +758,7 @@ class ApiParse extends ApiBase {
                        'generatexml' => "Generate XML parse tree (requires contentmodel=$wikitext)",
                        'preview' => 'Parse in preview mode',
                        'sectionpreview' => 'Parse in section preview mode (enables preview mode too)',
+                       'disabletoc' => 'Disable table of contents in output',
                        'contentformat' => array(
                                'Content serialization format used for the input text',
                                "Only valid when used with {$p}text",