feature(rendy) v1.1.0

This commit is contained in:
coderaiser 2015-05-21 07:02:48 -04:00
parent ca824c07eb
commit f63a14aa18
2 changed files with 9 additions and 8 deletions

View file

@ -206,18 +206,19 @@
* function render template with view and own symbols
*
* @param templ
* @param view
* @param data
*/
this.render = function(templ, view) {
var result = templ;
this.render = function(templ, data) {
var result = templ;
Object
.keys(view)
.keys(data)
.forEach(function(param) {
var str = view[param],
regExp = RegExp('{{\\s' + param + '\\s}}', 'g');
var name = '{{ ' + param + ' }}',
str = data[param];
result = result.replace(regExp, str);
while(~result.indexOf(name))
result = result.replace(name, str);
});
if (~result.indexOf('{{'))

View file

@ -55,7 +55,7 @@
"mollify": "~1.0.0",
"pipe-io": "~1.1.1",
"ponse": "~1.3.0",
"rendy": "~1.0.2",
"rendy": "~1.1.0",
"restafary": "~1.3.0",
"socket.io": "~1.3.5",
"try-catch": "~1.0.0",