From: Max Semenik Date: Tue, 17 Dec 2013 22:31:17 +0000 (+0400) Subject: API: allow disabling TOC in action=parse X-Git-Tag: 1.31.0-rc.0~17587^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=36fd28184a75815c1f22cdf30c23a67b546985fd API: allow disabling TOC in action=parse Change-Id: If9652bbae97ce40c8695affeb28be6088949dfd2 --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 3e7743454c..783ca3ca97 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 88904c0c73..a323aad954 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",