Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61984


Change subject: Tweaks to bugSplit.js
......................................................................

Tweaks to bugSplit.js

* Replace a few dir-name unfriendly chars.
* Add charset metas to diffs so they can be viewed in a browser.

Change-Id: I3832108b5a75104ee73deec6eafdccee2d178cc0
---
M js/tests/bugSplit.js
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/84/61984/1

diff --git a/js/tests/bugSplit.js b/js/tests/bugSplit.js
index 85e6e1a..f8251a8 100755
--- a/js/tests/bugSplit.js
+++ b/js/tests/bugSplit.js
@@ -9,13 +9,15 @@
 
 function writeFiles ( bugfileName, data ) {
        var keys = Object.keys(data),
-               val, dirName;
+               val, title, dirName;
+
+       // Fix some chars which wont be valid unix directory chars
+       title = (data.title || 'no-title').replace(/[\(\):\/]/g, '-');
 
        // SSS: the 'wiki' field adds the 'wiki' string at the end
        // which is unnecessary
        dirName = "./" + (data.wiki || 'none').replace(/wiki$/, '') + "." +
-               (data.title || 'no-title') + "." +
-               (data.timestamp || ('now-' + JSON.stringify(new Date())));
+               title + "." + (data.timestamp || ('now-' + JSON.stringify(new 
Date())));
 
        // Create dir
        fs.mkdirSync(dirName, "0755");
@@ -28,6 +30,10 @@
 
                val = data[key];
 
+               // Make diff readable by adding a charset meta
+               if (fileName === 'diff') {
+                       val = "<html><head><meta charset='utf-8'></head><body>" 
+ val + "</body></html>";
+               }
                if (fileName === 'originalHtml') {
                        // Strip everything upto <body> and after </body> tag
                        val = val.replace(/^.*<body[^<>]*>|<\/body>.*$/g, '');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3832108b5a75104ee73deec6eafdccee2d178cc0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/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