From 36fd28184a75815c1f22cdf30c23a67b546985fd Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Wed, 18 Dec 2013 02:31:17 +0400 Subject: [PATCH] API: allow disabling TOC in action=parse Change-Id: If9652bbae97ce40c8695affeb28be6088949dfd2 --- RELEASE-NOTES-1.23 | 1 + includes/api/ApiParse.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 3e7743454cb..783ca3ca97b 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -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=== diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 88904c0c73d..a323aad9543 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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", -- 2.11.4.GIT