Tim Starling has uploaded a new change for review.
https://gerrit.wikimedia.org/r/297930
Change subject: Don't run the non-Tidy "bug 2702" hack unless Tidy is really
missing
......................................................................
Don't run the non-Tidy "bug 2702" hack unless Tidy is really missing
We have two hacks which are used when Tidy is not available: one in
Sanitizer::removeHTMLtags(), and the second here as a late Parser pass
equivalent to Tidy itself. But the Sanitizer one was enabled only if
MWTidy::isEnabled() returned false, whereas the Parser one was enabled
also when tidy was disabled in ParserOptions. This patch makes them both
consistent, it enables the bug 2702 hack only when MWTidy::isEnabled()
returns false, and when Tidy is disabled in parser options, the output
is simply passed through.
This allows tidying to be done separately on the ParserOutput, as is
required by the proposed ParserMigration extension (I24d0776a933fa3f).
Eventually the bug 2702 hack will be removed in favour of a pure-PHP
HTML 5 parser, but it looks like it is too early for that.
Change-Id: I94be6c9dec531c23ef80cb36732243bd6858bf22
---
M includes/parser/Parser.php
1 file changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/30/297930/1
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index bd2f131..087708c 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1353,9 +1353,11 @@
$text = Sanitizer::normalizeCharReferences( $text );
- if ( MWTidy::isEnabled() && $this->mOptions->getTidy() ) {
- $text = MWTidy::tidy( $text );
- $this->mOutput->addModuleStyles(
MWTidy::getModuleStyles() );
+ if ( MWTidy::isEnabled() ) {
+ if ( $this->mOptions->getTidy() ) {
+ $text = MWTidy::tidy( $text );
+ $this->mOutput->addModuleStyles(
MWTidy::getModuleStyles() );
+ }
} else {
# attempt to sanitize at least some nesting problems
# (bug #2702 and quite a few others)
--
To view, visit https://gerrit.wikimedia.org/r/297930
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94be6c9dec531c23ef80cb36732243bd6858bf22
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits