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

Change subject: Suppress --!> as a comment closing tag in browsers
......................................................................


Suppress --!> as a comment closing tag in browsers

 * By converting it to --¡>

 * Still dirty diffs, but the behavior is consistent with what the
   php+tidy combination gives us and should be covered up by selser.

 * Ex. semediawiki/Nästa_dagordning?oldid=27867

Bug: 58184
Change-Id: I99ff6b5058683f535f6fdc38d8e4edb5b43c6210
---
M lib/pegTokenizer.pegjs.txt
M tests/parserTests.txt
2 files changed, 20 insertions(+), 2 deletions(-)

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



diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index c411907..4b63049 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -360,16 +360,21 @@
     / & { stops.dec('h'); return false; }
     ) { return r; }
 
+
 comment
     ='<!--' c:comment_chars* ('-->' / eof)
     {
-        return [new CommentTk( c.join(''), { tsr: [peg$reportedPos, 
peg$currPos] } )];
+        var data = c.join('');
+        // Bug 58184: Browsers leniently accept --!> as a closing comment tag,
+        // which differs from the php+tidy combo. Suppress that behaviour at
+        // the cost of introducing a dirty diff. Selser should take care of it.
+        data = data.replace(/--!>/g, "--¡>");
+        return [new CommentTk( data, { tsr: [peg$reportedPos, peg$currPos] } 
)];
     }
 
 comment_chars
   = c:[^-] { return c; }
   / c:'-' !'->' { return c; }
-
 
 
 // Behavior switches. See 
https://www.mediawiki.org/wiki/Help:Magic_words#Behavior_switches
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index fa1ec0f..89d2c48 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -1487,6 +1487,19 @@
 
 !! end
 
+# Bug 58184: document parsoid's behaviour
+!! test
+Suppress comment closing tag in lenient browsers
+!! options
+parsoid=wt2html,html2html
+!! wikitext
+<!-- Browsers--!> think this is closed -->
+!! html/php
+
+!! html/parsoid
+<!-- Browsers--¡> think this is closed -->
+!! end
+
 !! test
 Comment in template title
 !! wikitext

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I99ff6b5058683f535f6fdc38d8e4edb5b43c6210
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@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