From eb351597e48c851cbb9dca9ac6cb549b2b9ddc99 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Fri, 21 Sep 2018 10:57:18 -0400 Subject: [PATCH] Deprecate the 'disabletidy' parameter for ApiParse This will be unsupported by future wikitext parsers, which always construct well-formed HTML. Bug: T198214 Change-Id: Ic189cd1b38bca5b9ec0ef9810555fe0cbd8b733d --- RELEASE-NOTES-1.32 | 3 +++ includes/api/ApiParse.php | 5 ++++- tests/phpunit/includes/api/ApiParseTest.php | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 72c47b6b89..499bf58130 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -167,6 +167,9 @@ production. content is not being preserved. 'fromsection-{slot}' and 'tosection-{slot}' instead expand the given text as if for a section edit. This effectively declines T183823 in favor of T185723. +* (T198214) The 'disabletidy' parameter to action=parse has been + deprecated; untidy output will not be supported by future wikitext + parsers. === Action API internal changes in 1.32 === * Added 'ApiParseMakeOutputPage' hook. diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 5c25b5a0e5..a78cb7f5ad 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -868,7 +868,10 @@ class ApiParse extends ApiBase { ], 'disablelimitreport' => false, 'disableeditsection' => false, - 'disabletidy' => false, + 'disabletidy' => [ + ApiBase::PARAM_DFLT => false, + ApiBase::PARAM_DEPRECATED => true, // Since 1.32 + ], 'disablestylededuplication' => false, 'generatexml' => [ ApiBase::PARAM_DFLT => false, diff --git a/tests/phpunit/includes/api/ApiParseTest.php b/tests/phpunit/includes/api/ApiParseTest.php index 7f2c1a6d5f..b20d43e28c 100644 --- a/tests/phpunit/includes/api/ApiParseTest.php +++ b/tests/phpunit/includes/api/ApiParseTest.php @@ -97,8 +97,7 @@ class ApiParseTest extends ApiTestCase { $this->assertCount( 1, $res[0] ); } else { $this->assertCount( 2, $res[0] ); - // This deliberately fails if there are extra warnings - $this->assertSame( [ 'parse' => [ 'warnings' => $warnings ] ], $res[0]['warnings'] ); + $this->assertSame( [ 'warnings' => $warnings ], $res[0]['warnings']['parse'] ); } } @@ -827,7 +826,8 @@ class ApiParseTest extends ApiTestCase { 'disabletidy' => '', ] ); - $this->assertParsedTo( "

Mixed up\n

", $res2 ); + $this->assertParsedTo( "

Mixed up\n

", $res2, + 'The parameter "disabletidy" has been deprecated.' ); } public function testFormatCategories() { -- 2.20.1