-
-
Save xuyang2/9581581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
this.tmpl3 = function tmpl(str, data) { | |
var value = "var out = ''; out+=" + "'" + | |
str.replace(/[\r\t\n]/g, " ") | |
.replace(/'(?=[^%]*%>)/g,"\t") | |
.split("'").join("\\'") | |
.split("\t").join("'") | |
.replace(/<%=(.+?)%>/g, "'; out += $1; out += '") | |
.split("<%").join("';") | |
.split("%>").join("out+='") | |
+ "'; return out;"; | |
return new Function("data", value); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment