Subramanya Sastry has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/357330 )

Change subject: T167081: Use non-greedy comment-stripping regexp in the 
sanitizer
......................................................................

T167081: Use non-greedy comment-stripping regexp in the sanitizer

* Added a new parser test

Change-Id: I9c85515af26e2b671871137cb554b7d246b45e1d
---
M lib/wt2html/tt/Sanitizer.js
M tests/parserTests.txt
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/30/357330/1

diff --git a/lib/wt2html/tt/Sanitizer.js b/lib/wt2html/tt/Sanitizer.js
index af408e1..7ff4051 100644
--- a/lib/wt2html/tt/Sanitizer.js
+++ b/lib/wt2html/tt/Sanitizer.js
@@ -866,7 +866,7 @@
        // This step cannot introduce character references or escape
        // sequences, because it replaces comments with spaces rather
        // than removing them completely.
-       text = text.replace(/\/\*.*\*\//g, ' ');
+       text = text.replace(/\/\*(.*?)\*\//g, ' ');
 
        // Fix up unmatched double-quote and single-quote chars
        // Full CSS syntax here: http://www.w3.org/TR/CSS21/syndata.html#syntax
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 8f2d296..2e0d903 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -17911,6 +17911,19 @@
 !! end
 
 !! test
+Sanitizer: Strip comments from CSS attributes
+!! options
+parsoid=wt2html,wt2wt
+!! wikitext
+<span style="margin:/*negate mbox-text padding */-0.125em -0.45em; 
/*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
+!! html/php
+<p><span style="margin: -0.125em -0.45em;  rgba(255, 0, 0, 0.3)">2013</span>
+</p>
+!! html/parsoid
+<p><span style="margin: -0.125em -0.45em;  rgba(255, 0, 0, 
0.3)">2013</span></p>
+!! end
+
+!! test
 Language converter: output gets cut off unexpectedly (T7757)
 !! options
 language=zh

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c85515af26e2b671871137cb554b7d246b45e1d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to