From 78e5c8d7af310c0f81da84f232c5a9c0eaf019cd Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Wed, 4 Apr 2018 10:18:56 -0700 Subject: [PATCH] Default installations to using RemexHtml for tidying MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This combines two changes – defaulting tidying to on, previously off, and defaulting the tidying library to RemexHtml, previously the tidy binary. Config options are going to be a bit of a mess until we drop support for the old tidy binary config route. Bug: T185753 Depends-On: I0a8973f508fbf65160177b003260831639828eeb Change-Id: I6879a77a78d780c7c056d807dde20682c6097d1b --- RELEASE-NOTES-1.31 | 4 ++++ includes/DefaultSettings.php | 7 ++++--- tests/phpunit/includes/parser/TidyTest.php | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index f40a422adb..2fde0bd505 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -31,6 +31,10 @@ production. * (T188472) The 'comma' value for $wgArticleCountMethod is no longer supported for performance reasons, and installations with this setting will now work as if it was configured with 'any'. +* (T185753) MediaWiki now defaults to using RemexHtml to tidy up user input, rather than + being off by default. If you wish to disable HTML tidying entirely, set $wgTidyConfig + to null; if you wish to use the old, deprecated Tidy external binary, both + set $wgTidyConfig to null and also set $wgUseTidy to true. * $wgLogAutopatrol now defaults to false instead of true. * $wgValidateAllHtml was removed and will be ignored. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 22f587ee15..a0f849e43a 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4264,8 +4264,9 @@ $wgAllowImageTag = false; /** * Configuration for HTML postprocessing tool. Set this to a configuration - * array to enable an external tool. Dave Raggett's "HTML Tidy" is typically - * used. See https://www.w3.org/People/Raggett/tidy/ + * array to enable an external tool. By default, we now use the RemexHtml + * library; historically, Dave Raggett's "HTML Tidy" was typically used. + * See https://www.w3.org/People/Raggett/tidy/ * * If this is null and $wgUseTidy is true, the deprecated configuration * parameters will be used instead. @@ -4286,7 +4287,7 @@ $wgAllowImageTag = false; * - tidyBin: For RaggettExternal, the path to the tidy binary. * - tidyCommandLine: For RaggettExternal, additional command line options. */ -$wgTidyConfig = null; +$wgTidyConfig = [ 'driver' => 'RemexHtml' ]; /** * Set this to true to use the deprecated tidy configuration parameters. diff --git a/tests/phpunit/includes/parser/TidyTest.php b/tests/phpunit/includes/parser/TidyTest.php index 62b84aa129..be5125c7e3 100644 --- a/tests/phpunit/includes/parser/TidyTest.php +++ b/tests/phpunit/includes/parser/TidyTest.php @@ -55,8 +55,8 @@ MathML; ' should survive tidy' ], [ 'foo', 'foo', ' should survive tidy' ], - [ "\nfoo", 'foo', ' should survive tidy' ], - [ "\nfoo", 'foo', ' should survive tidy' ], + [ "foo", 'foo', ' should survive tidy' ], + [ "foo", 'foo', ' should survive tidy' ], [ $testMathML, $testMathML, ' should survive tidy' ], ]; } -- 2.20.1