Skip to content

Commit

Permalink
Merged in manic@53ffed0 and manic@ebec9ea changing single-quotes to d…
Browse files Browse the repository at this point in the history
…ouble-quotes
  • Loading branch information
rdworth committed Apr 6, 2010
2 parents 267d7fc + ebec9ea commit ea92c63
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions jquery.tmpl.js
Expand Up @@ -71,31 +71,31 @@
*/

tmplcmd: {
comment: {
"comment": {
prefix: "/*",
suffix: "*/"
},
each: {
"each": {
_default: [ null, "$i" ],
prefix: "jQuery.each($1,function($2){with(this){",
suffix: "}});"
},
if: {
"if": {
prefix: "if( (function(){try{return $1;}catch(err){if(err.name!=='ReferenceError'){throw err;}return undefined;}}()) ){",
suffix: "}"
},
ifdef: {
"ifdef": {
prefix: "if( typeof( (function(){try{return $1;}catch(err){if(err.name!=='ReferenceError'){throw err;}return undefined;}}()) ) !== 'undefined' ){",
suffix: "}"
},
ifndef: {
"ifndef": {
prefix: "if( typeof( (function(){try{return $1;}catch(err){if(err.name!=='ReferenceError'){throw err;}return undefined;}}()) ) === 'undefined' ){",
suffix: "}"
},
else: {
"else": {
prefix: "}else{"
},
html: {
"html": {
prefix: "_.push(typeof $1==='function'?$1.call(this):$1);"
},
"=": {
Expand All @@ -119,6 +119,7 @@

// Convert the template into pure JavaScript
str
.replace(/([\\'])/g, "\\$1")
.replace(/[\r\t\n]/g, " ")
.replace(/\${([^}]*)}/g, "{{= $1}}")
.replace(/{{(\/?)(\w+|.)(?:\((.*?)\))?(?: (.*?))?}}/g, function(all, slash, type, fnargs, args) {
Expand Down

0 comments on commit ea92c63

Please sign in to comment.