Mercurial > pub > ImplabJs
comparison src/implab/text/template-compile.js @ 14:5fd2a35d65c0
Слияние
author | cin |
---|---|
date | Fri, 08 Sep 2017 13:45:10 +0300 |
parents | 23be39fd3851 |
children | 7c22fc01fcec |
comparison
equal
deleted
inserted
replaced
13:3d4abbce4afc | 14:5fd2a35d65c0 |
---|---|
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, |