From b6b2104bd85e55256c47e87914a772e190e62aa6 Mon Sep 17 00:00:00 2001 From: Marco Pantaleoni Date: Wed, 3 Apr 2013 16:46:21 +0200 Subject: [PATCH] Added support for running CoffeeScript. (Slide HTML must include the CoffeeScript compiler: http://coffeescript.org/extras/coffee-script.js) --- deck.codemirror.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deck.codemirror.js b/deck.codemirror.js index 3d00b82..eab50a1 100644 --- a/deck.codemirror.js +++ b/deck.codemirror.js @@ -197,7 +197,13 @@ } }); - combinedSource += editor.getValue(); + var editorSource = editor.getValue(); + var editorCompiled = editorSource; + var mode = $(codeblock).attr('mode') || "javascript"; + if ((mode === 'coffeescript') || (mode == 'x-coffeescript') || (mode === 'text/coffeescript') || (mode == 'text/x-coffeescript')) { + editorCompiled = CoffeeScript.compile(editorSource, {bare: true}); + } + combinedSource += editorCompiled; // Append all cleanup scripts $.each(cleanupScripts, function() {