GWicke has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92416
Change subject: Bug 56195: Only trigger indent-pre on space
......................................................................
Bug 56195: Only trigger indent-pre on space
This causes some extra selser failures which all seem to be related to missing
nowiki escaping where it is no longer needed.
Change-Id: I4f8255d03dce047e96b60f0dee3909fb3c96fe37
---
M js/lib/ext.core.PreHandler.js
M js/tests/parserTests-blacklist.js
2 files changed, 18 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/16/92416/1
diff --git a/js/lib/ext.core.PreHandler.js b/js/lib/ext.core.PreHandler.js
index b13c92b..ad4ac3b 100644
--- a/js/lib/ext.core.PreHandler.js
+++ b/js/lib/ext.core.PreHandler.js
@@ -325,12 +325,12 @@
} else {
switch (this.state) {
case PreHandler.STATE_SOL:
- if ((tc === String) && token.match(/^\s/) &&
!this.inPre) {
+ if ((tc === String) && token.match(/^ /) &&
!this.inPre) {
ret = this.tokens;
this.tokens = [];
this.preWSToken = token[0];
this.state = PreHandler.STATE_PRE;
- if (!token.match(/^\s$/)) {
+ if (!token.match(/^ $/)) {
// Treat everything after the
first space
// as a new token
this.onAny(token.slice(1),
manager, cb);
@@ -379,7 +379,7 @@
break;
case PreHandler.STATE_MULTILINE_PRE:
- if ((tc === String) && token.match(/^\s/)) {
+ if ((tc === String) && token.match(/^ /)) {
this.popLastNL(this.tokens);
this.state =
PreHandler.STATE_PRE_COLLECT;
@@ -389,7 +389,7 @@
// check if token is single-space or
more
this.multiLinePreWSToken = token[0];
- if (!token.match(/^\s$/)) {
+ if (!token.match(/^ $/)) {
// Treat everything after the
first space as a new token
this.onAny(token.slice(1),
manager, cb);
}
diff --git a/js/tests/parserTests-blacklist.js
b/js/tests/parserTests-blacklist.js
index 413f8d2..5b54f92 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -45,7 +45,6 @@
add("wt2html", "Entities inside <nowiki>");
add("wt2html", "Comment on its own line post-expand");
add("wt2html", "Comment on its own line post-expand with non-significant
whitespace");
-add("wt2html", "Tabs don't trigger preformatted text");
add("wt2html", "Bug 52763: Preformatted in <blockquote>");
add("wt2html", "Templates: Indent-Pre: 1a. Templates that break a line should
suppress <pre>");
add("wt2html", "Templates: Indent-Pre: 1b. Templates that break a line should
suppress <pre>");
@@ -546,7 +545,6 @@
add("wt2wt", "Tabs don't trigger preformatted text");
add("wt2wt", "<nowiki> inside <pre> (bug 13238)");
add("wt2wt", "<nowiki> and <pre> preference (first one wins)");
-add("wt2wt", "4. Multiple spaces at start-of-line");
add("wt2wt", "5. White-space in indent-pre\nNOTE: the white-space char on 2nd
line is significant");
add("wt2wt", "6. Pre-blocks should extend across lines with leading WS even
when there is no wrappable content");
add("wt2wt", "HTML-pre: 1. embedded newlines");
@@ -2419,10 +2417,18 @@
add("selser", "Comment semantics: unclosed comment at end [3]", "<!--This
comment will run out to the end of the document");
add("selser", "Comment semantics: unclosed comment at end [4]", "<!--This
comment will run out to the end of the document");
add("selser", "Comment semantics: unclosed comment at end [2]", "<!--This
comment will run out to the end of the document");
-add("selser", "Tabs don't trigger preformatted text [[4]]", "\tThis is not\n\t
preformatted text.\n This is preformatted text.\n \tSo is this.");
-add("selser", "Tabs don't trigger preformatted text [2]",
"l7wt6v8iaiwzh0k9\n\tThis is not\n\t preformatted text.\n This is preformatted
text.\n \tSo is this.");
-add("selser", "Tabs don't trigger preformatted text [[3]]", "\tThis is not\n\t
preformatted text.\n This is preformatted text.\n \tSo is this.");
-add("selser", "Tabs don't trigger preformatted text [[2]]", "\tThis is not\n\t
preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [[4],0,0]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [2,2,[2]]",
"l7wt6v8iaiwzh0k9\t\n\nThis is not\n\t preformatted text.\n This is
preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [0,0,[4]]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [0,3,1]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [2,0,0]",
"pgtgiah3b7f1or\t\n\nThis is not\n\t preformatted text.\n This is preformatted
text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [[3],3,0]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [0,2,3]", "\tThis is
not\n\t preformatted text.\n");
+add("selser", "Tabs don't trigger preformatted text [[4],0,[3]]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [0,0,4]", "\tThis is
not\n\t preformatted text.\na337mw3hpey4lsor");
+add("selser", "Tabs don't trigger preformatted text [[3],0,1]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [[2],0,0]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
+add("selser", "Tabs don't trigger preformatted text [0,0,1]", "\tThis is
not\n\t preformatted text.\n This is preformatted text.\n \tSo is this.");
add("selser", "<nowiki> inside <pre> (bug 13238) [4,2,2,0,0]",
"ptjux9vq9zarlik9\ny7rebotz1jo1dcxr<pre>\n<nowiki></nowiki>\n</pre>\n<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>");
add("selser", "<nowiki> inside <pre> (bug 13238) [0,0,4,0,[[4],0,2,4]]",
"<pre>\n<nowiki>\n</pre>\n4bu012lyu5l8fr\n<pre><nowiki><nowiki></nowiki>Foo3iwsls5l4dzhbyb9<nowiki></nowiki></nowiki></pre>");
add("selser", "<nowiki> inside <pre> (bug 13238) [3,0,3,3,2]",
"\np32i6amoddb9y66r<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>");
@@ -2445,9 +2451,6 @@
add("selser", "<nowiki> and <pre> preference (first one wins)
[2,4,[2,0],4,[[3],0],0]",
"kg5ysu07a5uerk9<pre>\n<nowiki>\n</pre>\nbs9yk9e1o4r3haor</nowiki>\n</pre>\n\n<nowiki>\n<pre>\n<nowiki>\n</pre>\n</nowiki>\n</pre>\n");
add("selser", "2a. Indent-Pre and tables [4,[0,[[3,0,3,3,[4],2],0]]]", " {|\n
|-\n !h1\n |foo||bar\n |}");
add("selser", "2c. Indent-Pre and tables (bug 42252) [[0,0,3,2]]", "{|\n |+
foo\n ! | bar\n|}");
-add("selser", "4. Multiple spaces at start-of-line [2,0,0,2]", " <p> foo
</p>\njmxd0hb7sz1wnrk9\n foo\n\t{|\n|foo\n|}");
-add("selser", "4. Multiple spaces at start-of-line [2,2,0,2]", "
zob5sdimzbzqia4i<p> foo </p>\n0ngw4sd25b87iudi\n foo\n\t{|\n|foo\n|}");
-add("selser", "4. Multiple spaces at start-of-line [0,3,0,2]", "
\n8ywnhcpkr93haor\n foo\n\t{|\n|foo\n|}");
add("selser", "5. White-space in indent-pre\nNOTE: the white-space char on 2nd
line is significant [[3,0,4]]", " a<br/>\n \n b");
add("selser", "5. White-space in indent-pre\nNOTE: the white-space char on 2nd
line is significant [2]", "zj3bbk6ucui8uxr\n a<br/>\n \n b");
add("selser", "5. White-space in indent-pre\nNOTE: the white-space char on 2nd
line is significant [1]", " a<br/>\n \n b");
@@ -3305,9 +3308,9 @@
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,[4],3]]", "<div itemscope>\n\t<meta itemprop=\"hello\"
content=\"world\">\n\t<meta http-equiv=\"refresh\" content=\"5\">\n\t<meta
itemprop=\"hello\" http-equiv=\"refresh\" content=\"5\">\n\t<link
itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\" itemprop=\"hello\"
href=\"{{SERVER}}\">\n</div>");
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,[2],0]]", "<div itemscope>\n\t<meta itemprop=\"hello\"
content=\"world\">\n\t<meta http-equiv=\"refresh\" content=\"5\">\n\t<meta
itemprop=\"hello\" http-equiv=\"refresh\" content=\"5\">\n\t<link
itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\" itemprop=\"hello\"
href=\"{{SERVER}}\">\n</div>");
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [1]", "<div itemscope=\"\" data-foobar=\"q8adwgvp6owjc3di\">\n\t<meta
itemprop=\"hello\" content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\">\n</div>");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,2,0]]", "<div itemscope=\"\">\ntphlnpjbn019k9\n\t<meta
itemprop=\"hello\" content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\">\n</div>");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,2,0]]", "<div itemscope=\"\">\n\ttphlnpjbn019k9\n\n<meta
itemprop=\"hello\" content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\">\n</div>");
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[3,0,4]]", "<div itemscope>\n\t<meta itemprop=\"hello\"
content=\"world\">\n\t<meta http-equiv=\"refresh\" content=\"5\">\n\t<meta
itemprop=\"hello\" http-equiv=\"refresh\" content=\"5\">\n\t<link
itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\" itemprop=\"hello\"
href=\"{{SERVER}}\">\n</div>");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,2,0]]", "<div itemscope=\"\">\nq21hg5f5s2kxzuxr\n\t<meta
itemprop=\"hello\" content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\">\n</div>");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,2,0]]", "<div itemscope=\"\">\n\tq21hg5f5s2kxzuxr\n\n<meta
itemprop=\"hello\" content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\">\n</div>");
add("selser", "Fuzz testing: Parser13 [2]", "whfwe630sy8pvi\n{| \n|
http://a|");
add("selser", "Fuzz testing: Parser13 [1]", "{|
data-foobar=\"k83lm0w7lheyiudi\"\n| http://a||}");
add("selser", "Fuzz testing: Parser13 [[2,2]]", "{|\n<!--ot0k5hk2dibe29-->|
http://a||}");
--
To view, visit https://gerrit.wikimedia.org/r/92416
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f8255d03dce047e96b60f0dee3909fb3c96fe37
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits