Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181777
Change subject: Tidy up tidy usage
......................................................................
Tidy up tidy usage
* Seems there are some branch paths that depend on $wgUseTidy and
friends being set.
Change-Id: I09c72fd739e11a8b757f37dc4c790758d782ad73
---
M tests/parser/parserTest.inc
M tests/parser/parserTests.txt
2 files changed, 35 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/77/181777/1
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index cf03ad1..621d701 100644
--- a/tests/parser/parserTest.inc
+++ b/tests/parser/parserTest.inc
@@ -577,6 +577,8 @@
* @return bool
*/
public function runTest( $desc, $input, $result, $opts, $config ) {
+ global $wgUseTidy, $wgAlwaysUseTidy;
+
if ( $this->showProgress ) {
$this->showTesting( $desc );
}
@@ -620,14 +622,21 @@
} elseif ( isset( $opts['preload'] ) ) {
$out = $parser->getPreloadText( $input, $title,
$options );
} else {
- $output = $parser->parse( $input, $title, $options,
true, true, 1337 );
- $output->setTOCEnabled( !isset( $opts['notoc'] ) );
- $out = $output->getText();
if ( isset( $opts['tidy'] ) ) {
if ( !$this->tidySupport->isEnabled() ) {
return $this->showSkipped();
}
- $out = MWTidy::tidy( $out );
+ $wgUseTidy = true;
+ $wgAlwaysUseTidy = true;
+ }
+
+ $output = $parser->parse( $input, $title, $options,
true, true, 1337 );
+ $output->setTOCEnabled( !isset( $opts['notoc'] ) );
+ $out = $output->getText();
+
+ if ( isset( $opts['tidy'] ) ) {
+ $wgUseTidy = false;
+ $wgAlwaysUseTidy = false;
$out = preg_replace( '/\s+$/', '', $out );
}
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index cf9d829..b41624a 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -1192,6 +1192,8 @@
!! test
Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
!! wikitext
+<blockquote|>a</blockquote>
+
<b→> doesn't work! </b→>
<bä> doesn't work! </bä>
@@ -1201,13 +1203,14 @@
<s.foo>s.foo</s.foo>
<sub-ID#1>
-!! html
-<p><b→> doesn't work! </b→>
-</p><p><bä> doesn't work! </bä>
-</p><p><boo> works fine </boo>
-</p><p><s.foo>s.foo</s.foo>
-</p><p><sub-ID#1>
-</p>
+!! html+tidy
+<blockquote>
+<p>a</p>
+</blockquote>
+<p><b→> doesn't work! </b→></p>
+<p><bä> doesn't work! </bä></p>
+<p><boo> works fine </boo></p>
+<p><s>s.foo</s></p>
!! end
!! test
@@ -1717,9 +1720,10 @@
b
!! html/php+tidy
<div>
-<p>foo</div></p>
+<p>foo</p>
+</div>
<p>a</p>
-b</div>
+<p>b</p>
!! html/parsoid
<div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html",
"autoInsertedEnd":true}'>foo</p></div>
<p>a</p>
@@ -7540,7 +7544,7 @@
<br/ >
!! html/php+tidy
-<p></br></p>
+<p><br /></p>
<p><br /></p>
!! html/parsoid
<p><br></p>
@@ -8155,7 +8159,6 @@
</tr>
</table>
!! html/php+tidy
-<p></tr></p>
<table>
<tr>
<td>foo</td>
@@ -13945,16 +13948,17 @@
!! end
# FIXME: this is still bad HTML tag nesting
+# FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
!! test
Media link with nasty text
-fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
!! wikitext
[[Media:Foobar.jpg|Safe Link<div style=display:none>"
onmouseover="alert(document.cookie)" onfoo="</div>]]
!! html
<a href="http://example.com/images/3/3a/Foobar.jpg" class="internal"
title="Foobar.jpg">Safe Link<div style="display:none">"
onmouseover="alert(document.cookie)" onfoo="</div></a>
!! html+tidy
-<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal"
title="Foobar.jpg">Safe Link<div style="display:none">"
onmouseover="alert(document.cookie)" onfoo="</div></a></p>
+<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal"
title="Foobar.jpg">Safe Link</a></p>
+<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
!! end
!! test
@@ -15169,6 +15173,7 @@
<li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span
class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
</ul>
</div>
+<p></p>
!! end
!! test
@@ -18918,6 +18923,7 @@
<h2><span class="mw-headline"
id="Quote"><blockquote>Quote</blockquote></span><span
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a
href="/index.php?title=Main_Page&action=edit&section=1" title="Edit
section: Quote">edit</a><span
class="mw-editsection-bracket">]</span></span></h2>
!! html+tidy
+<p></p>
<div id="toc" class="toc">
<div id="toctitle">
<h2>Contents</h2>
@@ -18926,6 +18932,7 @@
<li class="toclevel-1 tocsection-1"><a href="#Quote"><span
class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
</ul>
</div>
+<p></p>
<h2><span class="mw-headline" id="Quote"></span></h2>
<blockquote>
<p><span class="mw-headline" id="Quote">Quote</span></p>
@@ -18974,6 +18981,7 @@
<h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i>
<blockquote>Bar</blockquote></span><span class="mw-editsection"><span
class="mw-editsection-bracket">[</span><a
href="/index.php?title=Parser_test&action=edit&section=2" title="Edit
section: Foo Bar">edit</a><span
class="mw-editsection-bracket">]</span></span></h2>
!! html+tidy
+<p></p>
<div id="toc" class="toc">
<div id="toctitle">
<h2>Contents</h2>
@@ -18983,6 +18991,7 @@
<li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span
class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
</ul>
</div>
+<p></p>
<h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a
href="/index.php?title=Parser_test&action=edit&section=1" title="Edit
section: Foo Bar">edit</a><span
class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
<blockquote>
--
To view, visit https://gerrit.wikimedia.org/r/181777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09c72fd739e11a8b757f37dc4c790758d782ad73
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits