jenkins-bot has submitted this change and it was merged.

Change subject: T147742: Trim template target after stripping comments
......................................................................


T147742: Trim template target after stripping comments

* Updated an existing test + fixed up blacklist.

Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255
---
M lib/wt2html/tt/TemplateHandler.js
M tests/parserTests-blacklist.js
M tests/parserTests.txt
3 files changed, 33 insertions(+), 24 deletions(-)

Approvals:
  Arlolra: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/wt2html/tt/TemplateHandler.js 
b/lib/wt2html/tt/TemplateHandler.js
index b26cea1..adac655 100644
--- a/lib/wt2html/tt/TemplateHandler.js
+++ b/lib/wt2html/tt/TemplateHandler.js
@@ -421,8 +421,11 @@
        if (tgtInfo.isStr && !tgtInfo.isSimpleTgt) {
                // resolvabilityInfo found a new target based on the target 
tokens. This
                // happens when the target contains special characters, 
specially quotes.
-               // For an example look at T96090.
-               target = tgtInfo.newTarget;
+               // For an example, look at T96090.
+
+               // Without a trim(), we get bug T147742 because
+               // the prefix === target check below fails!
+               target = tgtInfo.newTarget.trim();
                pieces = target.split(':');
                prefix = pieces[0].trim();
                lowerPrefix = prefix.toLowerCase();
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index e283b6a..98db18c 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -283,7 +283,7 @@
 add("wt2wt", "<nowiki> inside <pre> (bug 13238)", 
"<pre>\n<nowiki>\n</pre>\n<pre>\n<nowiki></nowiki>\n</pre>\n<pre><nowiki>&lt;nowiki&gt;</nowiki>Foo<nowiki></nowiki></nowiki></pre>");
 add("wt2wt", "<nowiki> and <pre> preference (first one wins)", 
"<pre>\n<nowiki>\n</pre>\n</nowiki>\n</pre>\n\n<nowiki>\n<pre>\n&lt;nowiki&gt;\n</pre>\n</nowiki>\n</pre>\n");
 add("wt2wt", "Templates: Indent-Pre: 1f: Wrapping should be based on expanded 
content", "{{echo| }}a\n\n{{echo|\n }}a\n\n{{echo|\n b}}\n\n{{echo|a\n 
}}b\n\n{{echo|a\n}}\n b\n");
-add("wt2wt", "Templates: Handle comments in the target", "{{echo\n<!-- should 
be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored -->|foo}}\n\n{{echo|foo}}");
+add("wt2wt", "Templates: Handle comments in the target", "{{echo\n<!-- should 
be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored and spaces on next 
line should not trip us up (T147742) -->\n  |foo}}\n\n{{echo<!-- should be 
ignored -->\n|foo}}\n\n{{echo<!-- should be ignored -->|foo}}\n\n{{echo|foo}}");
 add("wt2wt", "4. Indent-Pre and extension tags", "<nowiki> </nowiki>a <tag 
/>");
 add("wt2wt", "Definition lists: self-closed tag", ";one<br />two : two-line 
fun");
 add("wt2wt", "Definition Lists: colons occurring in tags", 
";a:b\n;'''a:b'''\n;<i>a:b</i>\n;<span>a:b</span>\n;<div>a:b</div>\n;<div>a\n:b\n;{{echo|a:b}}\n;{{echo|''a:b''}}\n;;;''a:b''\n");
@@ -397,7 +397,7 @@
 add("html2html", "<pre> with forbidden attribute values (bug 3202)", "<pre 
data-parsoid='{\"dsr\":[0,22,1,0]}'>Narrow screen goodies</pre>\n");
 add("html2html", "<nowiki> inside <pre> (bug 13238)", "<pre 
data-parsoid='{\"dsr\":[0,15,1,0]}'><span typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;lt;\",\"srcContent\":\"&lt;\",\"dsr\":[1,5,null,null]}'>&lt;</span>nowiki<span
 typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[11,15,null,null]}'>></span></pre>\n\n
 <p data-parsoid='{\"dsr\":[18,18,0,0]}'><br 
data-parsoid='{\"dsr\":[18,18,0,0]}'/></p>\n\n<pre 
data-parsoid='{\"dsr\":[20,53,1,0]}'><span typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;lt;\",\"srcContent\":\"&lt;\",\"dsr\":[21,25,null,null]}'>&lt;</span>nowiki<span
 typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[31,35,null,null]}'>></span>Foo<span
 typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;lt;\",\"srcContent\":\"&lt;\",\"dsr\":[38,42,null,null]}'>&lt;</span>/nowiki<span
 typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[49,53,null,null]}'>></span></pre>\n");
 add("html2html", "<nowiki> and <pre> preference (first one wins)", "<pre 
data-parsoid='{\"stx\":\"html\",\"strippedNL\":true,\"dsr\":[0,21,5,6]}'>&lt;nowiki>\n</pre>\n<p
 data-parsoid='{\"dsr\":[22,38,0,0]}'><span typeof=\"mw:Placeholder\" 
data-parsoid='{\"src\":\"&lt;/nowiki>\",\"dsr\":[22,31,null,0]}'>&lt;/nowiki></span>\n&lt;/pre></p>\n\n<p
 data-parsoid='{\"dsr\":[40,93,0,0]}'><span typeof=\"mw:Nowiki\" 
data-parsoid='{\"dsr\":[40,86,8,9]}'>\n&lt;pre>\n<span typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;lt;\",\"srcContent\":\"&lt;\",\"dsr\":[55,59,null,null]}'>&lt;</span>nowiki<span
 typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[65,69,null,null]}'>></span>\n&lt;/pre>\n</span>\n&lt;/pre></p>\n");
-add("html2html", "Templates: Handle comments in the target", "<p 
about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,39,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo &lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[41,79,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo&lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[81,119,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo&lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt4\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[121,133,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>");
+add("html2html", "Templates: Handle comments in the target", "<p 
about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,39,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo &lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[41,136,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo &lt;!-- should be 
ignored and spaces on next line should not trip us up (T147742) 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[138,176,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo&lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt4\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[178,216,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo&lt;!-- should be 
ignored 
-->\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>\n\n<p
 about=\"#mwt5\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[218,230,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>");
 add("html2html", "Templates: Handle comments in parameter names (bug 67657)", 
"<p about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,41,0,0],\"pi\":[[{\"k\":\"1\",\"named\":true}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\",\"key\":{\"wt\":\"1
 &lt;!-- should be ignored -->\"}}},\"i\":0}}]}'>foo</p>\n\n<p about=\"#mwt2\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[43,84,0,0],\"pi\":[[{\"k\":\"1\",\"named\":true}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\",\"key\":{\"wt\":\"&lt;!--
 should be ignored --> 1\"}}},\"i\":0}}]}'>foo</p>\n\n<p about=\"#mwt3\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[86,126,0,0],\"pi\":[[{\"k\":\"1\",\"named\":true}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\",\"key\":{\"wt\":\"1&lt;!--
 should be ignored -->\"}}},\"i\":0}}]}'>foo</p>\n\n<p about=\"#mwt4\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[128,168,0,0],\"pi\":[[{\"k\":\"1\",\"named\":true}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\",\"key\":{\"wt\":\"&lt;!--
 should be ignored -->1\"}}},\"i\":0}}]}'>foo</p>");
 add("html2html", "Templates: Other wikitext in parameter names (bug 67657)", 
"<p about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,18,0,0],\"pi\":[[{\"k\":\"&#39;&#39;1&#39;&#39;\",\"named\":true}]]}'
 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"&#39;&#39;1&#39;&#39;\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</p>");
 add("html2html", "2g. Indented table markup mixed with indented pre content 
(proposed in bug 6200)", " <table 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[1,57,2,0]}'> \n <tbody 
data-parsoid='{\"dsr\":[6,57,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[6,56,0,0]}'><td
 data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[6,56,1,0]}'>\n<pre 
data-parsoid='{\"dsr\":[8,56,1,0]}'>Text that should be rendered preformatted  
\n|}</pre></td></tr>\n</tbody></table>");
@@ -673,7 +673,7 @@
 add("html2wt", "Templates: Strip leading and trailing whitespace from 
named-param values", "a\n\nb\n\nc\n\n* d\n");
 add("html2wt", "Templates: Don't strip whitespace from positional-param 
values", "a \n\nb \n\n c \n\n\n\n d\n\n\n\n e\n\n\n\n* f\n\n\n g\n");
 add("html2wt", "Templates: Handle empty comment-and-ws-only lines correctly", 
"foo\nbar\n");
-add("html2wt", "Templates: Handle comments in the target", "{{echo <!-- should 
be ignored -->|foo}}\n\n{{echo<!-- should be ignored -->|foo}}\n\n{{echo<!-- 
should be ignored -->|foo}}\n\n{{echo|foo}}");
+add("html2wt", "Templates: Handle comments in the target", "{{echo <!-- should 
be ignored -->|foo}}\n\n{{echo <!-- should be ignored and spaces on next line 
should not trip us up (T147742) -->|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{echo<!-- should be ignored -->|foo}}\n\n{{echo|foo}}");
 add("html2wt", "Templates: Handle comments in parameter names (bug 67657)", 
"{{echo|1 <!-- should be ignored -->=foo}}\n\n{{echo|<!-- should be ignored --> 
1=foo}}\n\n{{echo|1<!-- should be ignored -->=foo}}\n\n{{echo|<!-- should be 
ignored -->1=foo}}");
 add("html2wt", "1a. Indent-Pre and Comments", " a\n\nc\n");
 add("html2wt", "1b. Indent-Pre and Comments", " a\n\nc\n");
@@ -1343,25 +1343,25 @@
 add("selser", "Templates: Indent-Pre: 1f: Wrapping should be based on expanded 
content [0,0,0,0,0,0,0,0,0,0,0,4,0,0,0]", "{{echo| }}a\n\n{{echo|\n 
}}a\n\n{{echo|\n b}}\n\n{{echo|a\n }}b\nbt5yrxqcb1d78pvi{{echo|a\n}} b");
 add("selser", "Templates: Indent-Pre: 1f: Wrapping should be based on expanded 
content [0,0,0,0,4,0,0,0,0,0,0,0,0,0,[2]]", "{{echo| }}a\n\n{{echo|\n 
}}a\n4kifb531krdd9529{{echo|\n b}}\n\n{{echo|a\n }}b\n\n{{echo|a\n}} 
7ujkiku3nn7mn29b");
 add("selser", "Templates: Indent-Pre: 1f: Wrapping should be based on expanded 
content [0,0,0,0,0,0,0,0,0,0,0,0,0,0,[4]]", "{{echo| }}a\n\n{{echo|\n 
}}a\n\n{{echo|\n b}}\n\n{{echo|a\n }}b\n\n{{echo|a\n}} f2d99w4cya7zaor");
-add("selser", "Templates: Handle comments in the target [0,0,0,3,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}{{<!-- should be ignored 
-->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,3,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\n{{<!-- should be ignored 
-->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,2,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n9ncpho3wpuhoxbt9\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,4,0,3,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nl9rw5g1g22hs38fr\n\n{{echo<!-- 
should be ignored -->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\n{{<!-- 
should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,0,0,2,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n9v9mkbqum3brcnmi\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,4,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\neffd0wpcayca0pb9\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,2,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\nhwwntyagv9a1nhfr\n\n{{echo<!-- should be ignored -->|foo}}{{<!-- 
should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,0,0,2,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n07oxlbecbt4q85mi\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,2,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\ndt51r00wxqjmj9k9\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,3,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\nv8be2ljmu606n7b9\n\n{{<!-- 
should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,4,0,0,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n1w4nz3fu3tc8r529\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored -->|foo}}{{<!-- 
should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,2,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}\n\ng3h399i2371wz5mi\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,0,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\nwaq51k3tb7wuerk9\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,2,0,2,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nxc73m35mloy74x6r\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\n6ur51wfou1munmi\n\n{{echo<!-- should be 
ignored -->|foo}}{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,2,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}\n\n67x59k75tpo561or\n\n{{echo<!-- should be ignored 
-->|foo}}\n\nwvrzv7ijo9k3ayvi\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,4,0,4,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\npmnvitmjwlzhncdi\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\nwe3f5jnl8pczncdi\n\n{{echo<!-- should be 
ignored -->|foo}}\n\nziylnllihba3v7vi\n\n{{<!-- should be ignored 
-->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,4,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\npk398lfm3w1rwwmi\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,3,0,3,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\n{{<!-- should be ignored 
-->echo|foo}}");
-add("selser", "Templates: Handle comments in the target [0,0,0,0,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\nhlr2vnanjhflayvi\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,3,0,3,0,2,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  |foo}}{{echo<!-- 
should be ignored -->\n|foo}}{{echo<!-- should be ignored 
-->|foo}}\n\ncze8l35co38a1yvi\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,3,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  |foo}}{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,3,0,0,0,2,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  |foo}}{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n9ncpho3wpuhoxbt9\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,4,0,3,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nl9rw5g1g22hs38fr\n\n{{echo\n<!-- 
should be ignored and spaces on next line should not trip us up (T147742) -->\n 
 |foo}}{{echo<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,0,0,2,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n9v9mkbqum3brcnmi\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,3,0,0,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  |foo}}{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\neffd0wpcayca0pb9\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,2,0,3,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nhwwntyagv9a1nhfr\n\n{{echo\n<!-- 
should be ignored and spaces on next line should not trip us up (T147742) -->\n 
 |foo}}{{echo<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,0,0,0,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\n{{echo<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be 
ignored -->|foo}}{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,2,0,0,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\ndt51r00wxqjmj9k9\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored -->|foo}}\n\n{{<!-- should be 
ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,2,0,0,0,4,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nv8be2ljmu606n7b9\n\n{{echo\n<!-- 
should be ignored and spaces on next line should not trip us up (T147742) -->\n 
 |foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\ns1x644pqvq1qyqfr\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,0,0,0,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\n{{echo<!-- should be ignored -->\n|foo}}\n\n{{echo<!-- should be 
ignored -->|foo}}\n\n1w4nz3fu3tc8r529\n\n{{<!-- should be ignored 
-->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,2,0,3,0,4,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\ng3h399i2371wz5mi\n\n{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\nzvk1a7s7edu6jemi\n\n{{<!-- 
should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,3,0,0,0,4,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo\n<!-- should be ignored and 
spaces on next line should not trip us up (T147742) -->\n  |foo}}\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\nwaq51k3tb7wuerk9\n\n{{echo<!-- should be 
ignored -->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,2,0,2,0,3,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\nxc73m35mloy74x6r\n\n{{echo\n<!-- 
should be ignored and spaces on next line should not trip us up (T147742) -->\n 
 |foo}}\n\n6ur51wfou1munmi\n\n{{echo<!-- should be ignored 
-->\n|foo}}{{echo<!-- should be ignored -->|foo}}\n\n{{<!-- should be ignored 
-->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,0,0,4,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n67x59k75tpo561or\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,4,0,4,0,4,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\npmnvitmjwlzhncdi\n\n{{echo\n<!-- 
should be ignored and spaces on next line should not trip us up (T147742) -->\n 
 |foo}}\n\nwe3f5jnl8pczncdi\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\nziylnllihba3v7vi\n\n{{echo<!-- should be ignored 
-->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,3,0,0,0,2,0,0,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo\n<!-- should be ignored and 
spaces on next line should not trip us up (T147742) -->\n  |foo}}\n\n{{echo<!-- 
should be ignored -->\n|foo}}\n\npk398lfm3w1rwwmi\n\n{{echo<!-- should be 
ignored -->|foo}}\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,3,0,3,0,0,0,2,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}{{echo\n<!-- should be ignored and 
spaces on next line should not trip us up (T147742) -->\n  |foo}}{{echo<!-- 
should be ignored -->\n|foo}}\n\n{{echo<!-- should be ignored 
-->|foo}}\n\nwuh3gcdk1olayvi\n\n{{<!-- should be ignored -->echo|foo}}");
+add("selser", "Templates: Handle comments in the target [0,0,0,4,0,0,0,3,0]", 
"{{echo\n<!-- should be ignored -->\n|foo}}\n\n{{echo\n<!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
|foo}}\n\nhlr2vnanjhflayvi\n\n{{echo<!-- should be ignored 
-->\n|foo}}\n\n{{echo<!-- should be ignored -->|foo}}{{<!-- should be ignored 
-->echo|foo}}");
 add("selser", "4. Indent-Pre and extension tags 5", "<nowiki> </nowiki>a <tag 
/>");
 add("selser", "4. Indent-Pre and extension tags [2,0]", "z2q1uxsvdja9vn29\n\n 
a <tag />");
 add("selser", "5a. White-space in indent-pre [[0,0,4]]", " a<br />\n 
7tmueg6dyhqia4i");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 536525a..750e590 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -2716,6 +2716,10 @@
 <!-- should be ignored -->
 |foo}}
 
+{{echo
+<!-- should be ignored and spaces on next line should not trip us up (T147742) 
-->
+  |foo}}
+
 {{echo<!-- should be ignored -->
 |foo}}
 
@@ -2725,6 +2729,8 @@
 !!html/parsoid
 <p typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored 
-->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
 
+<p typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored 
and spaces on next line should not trip us up (T147742) -->\n  
","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
+
 <p typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored 
-->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
 
 <p typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored 
-->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>

-- 
To view, visit https://gerrit.wikimedia.org/r/316213
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to