Mercurial > pub > ImplabJs
comparison src/implab/text/template-compile.js @ 12:23be39fd3851
fixed typo in template-compile the built-in function 'print'
author | cin |
---|---|
date | Thu, 24 Aug 2017 04:30:11 +0300 |
parents | f0035923ff3e |
children | 7c22fc01fcec |
comparison
equal
deleted
inserted
replaced
11:67a5de7581ad | 12:23be39fd3851 |
---|---|
1 define( | 1 define( |
2 [ "dojo/request", "./format" ], | 2 [ "dojo/request", "./format" ], |
3 function(request, format) { | 3 function(request, format) { |
4 var compile = function(str) { | 4 var compile = function(str) { |
5 var code = "var p=[],print=function(){p.push(foramt.apply(null,arguments));};" + | 5 var code = "var p=[],print=function(){p.push(format.apply(null,arguments));};" + |
6 // Introduce the data as local variables using with(){} | 6 // Introduce the data as local variables using with(){} |
7 "with(obj){p.push('" + | 7 "with(obj){p.push('" + |
8 // Convert the template into pure JavaScript | 8 // Convert the template into pure JavaScript |
9 str.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace( | 9 str.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace( |
10 /(^|%>)[^\t]*/g, | 10 /(^|%>)[^\t]*/g, |