Added a readme file and made a few fixes that were discovered while writing it.

This commit is contained in:
Alan Johnson
2010-09-06 22:53:48 -04:00
parent 1a8036650b
commit 0767acc36c
2 changed files with 120 additions and 1 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
Handlebars = {
compile: function(string) {
var fnBody = Handlebars.compileFunctionBody(string);
console.log(fnBody);
return new Function("context", "fallback", fnBody);
},
@@ -22,6 +23,7 @@ Handlebars = {
escapeText: function(string) {
string = string.replace("'", "\\'");
string = string.replace("\"", "\\\"");
if (string.slice(-1) == "\\") {
string = string + "\\";
}
@@ -38,7 +40,7 @@ Handlebars = {
string = "";
}
return string.replace(/&(?!\w+;)|["\\<>]/g, function(str) {
return string.toString().replace(/&(?!\w+;)|["\\<>]/g, function(str) {
switch(str) {
case "&":
return "&amp;";