From 36ba38d68562d461a12d3c69700d014c00dfa5d8 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 3 Jan 2012 12:42:34 +0000 Subject: [PATCH] Bugfix and removed dead code --- js/Sandbox.js | 38 -------------------------------------- js/WikiTextCompiler.js | 1 + 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/js/Sandbox.js b/js/Sandbox.js index d84077390..8f9fb8e10 100644 --- a/js/Sandbox.js +++ b/js/Sandbox.js @@ -19,44 +19,6 @@ Sandbox.prototype.parse = function(code) { return this.parser.parse(code); }; -Sandbox.prototype.execute = function(code,globals) { - var globalNames = [], - globalValues = [], - collectGlobals = function(globals) { - if(globals) { - for(var g in globals) { - globalNames.push(g); - globalValues.push(globals[g]); - } - } - }; - // Collect the supplied globals - collectGlobals(globals); - // Add the default globals - collectGlobals({ - tiddlywiki: "5" - }); - // Compose the code - var out = []; - out.push("(function("); - out.push(globalNames.join(",")); - out.push(") { return "); - out.push(code); - out.push(";})"); - // Parse the code - var compiledCode = out.join(""), - tree = this.parser.parse(out.join("")); - // XXX: Sanitise the code by checking for references to globals, stripping out eval() - // Execute it - var result; - try { - result = eval(compiledCode).apply(null,globalValues); - } catch(err) { - result = "{{** Evaluation error: " + err + " **}}"; - } - return result; -}; - exports.Sandbox = Sandbox; })(); \ No newline at end of file diff --git a/js/WikiTextCompiler.js b/js/WikiTextCompiler.js index 2a0db684c..7ae1186e2 100644 --- a/js/WikiTextCompiler.js +++ b/js/WikiTextCompiler.js @@ -60,6 +60,7 @@ WikiTextCompiler.prototype.compileAsHtml = function(treenode) { } pushString("<" + tagBits.join(" ") + (options.selfClosing ? " /" : "")); if(options.insertAfterAttributes) { + pushString(" "); output.push(options.insertAfterAttributes); } pushString(">");