Skip to content

Commit

Permalink
Updated sample and fixed escaping in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Sep 30, 2011
1 parent 0f22dc7 commit 9befcb2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
CoderDeck
=========

"The easiest way to show and teach the web is the with the web"
- Ancient Mozilla Proverb
Create interactive live-coding presentations for the web.

CoderDeck combines Deck.js with the CodeMirror2 highlighting code editor to
make it easy to demo and teach live HTML, CSS and Javascript directly in the browser.



CoderDeck is Copyright (c)2011 Cykod LLC

Deck.js, CodeMirror2, jQuery et al are (c) their respective owners.
Expand Down
10 changes: 6 additions & 4 deletions sample-dist.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ <h2>I'm a H2 heading</h2>
</body>
</html>
</script>

<article class='slide slide-subhead'>
<h1>CoderDeck sample</h1>
<h2>Run "make" to build the dist directory</h2>

<h1>CoderDeck</h1>
<h2><a href='http://github.com/cykod/CoderDeck'>http://github.com/cykod/CoderDeck</a><br/>
create interactive live-coding presentations for the web.<br/>
use the arrow-keys go between slides.
</h2>
</article>

<!-- Apply a class of "coder-editor" to a textarea to make it show up as runnable code -->
Expand Down
5 changes: 4 additions & 1 deletion sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ <h2>I'm a H2 heading</h2>

<article class='slide slide-subhead'>
<h1>CoderDeck</h1>
<h2>Deck.js + CodeMirror2 = CoderDeck</h2>
<h2><a href='http://github.com/cykod/CoderDeck'>http://github.com/cykod/CoderDeck</a><br/>
create interactive live-coding presentations for the web.<br/>
use the arrow-keys go between slides.
</h2>
</article>

<!-- Apply a class of "coder-editor" to a textarea to make it show up as runnable code -->
Expand Down
8 changes: 6 additions & 2 deletions src/deck.coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ This module adds a code editor that shows up in individual slides
$window = $(window);

function unsanitize(str) {
return str.replace(/SCRIPTEND/,'</s' + 'cript>').replace(/SCRIPT/g,'<script>').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
return addScript(str).replace(/&lt;/g,'<').replace(/&gt;/g,'>');
}

function addScript(str) {
return str.replace(/SCRIPTEND/,'</s' + 'cript>').replace(/SCRIPT/g,'<script>')
}

function runCode(element,template) {
Expand All @@ -39,7 +43,7 @@ This module adds a code editor that shows up in individual slides

var tmpl = $(template ? "#" + template : "#coderdeck-default").html();

code = "<!DOCTYPE HTML>" + unsanitize(tmpl).replace(/CODE/,code);
code = "<!DOCTYPE HTML>" + addScript(tmpl).replace(/CODE/,code);

writeIFrame(iframe,code);
}
Expand Down

0 comments on commit 9befcb2

Please sign in to comment.