From 86e119dbf266b95d3c48c217199518a33f3bfe1a Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 4 Mar 2012 12:01:44 +0000 Subject: [PATCH] Replace tabs in JavaScript with spaces Browsers will render tabs, but most don't let us override their default of 8 character tab stops --- js/JavaScriptParser.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/JavaScriptParser.js b/js/JavaScriptParser.js index d7835b3f7..9fba14b61 100644 --- a/js/JavaScriptParser.js +++ b/js/JavaScriptParser.js @@ -18,8 +18,10 @@ var JavaScriptParser = function(options) { this.store = options.store; }; -// Parse a string of JavaScript code or JSON and return the parse tree as a wikitext parse tree +// Parse a string of JavaScript code and return the parse tree as a wikitext parse tree JavaScriptParser.prototype.parse = function(type,code) { + // Simplisticly replace tabs with spaces. Browsers will happily render tabs but most default to 8 character tab stops + code = code.replace(/\t/mg," "); // Try to parse the code var parseTree; try {