diff --git a/lib/util.js b/lib/util.js index a9bd8217..0a24383a 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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('{{')) diff --git a/package.json b/package.json index 65e6a3e3..683c7ecd 100644 --- a/package.json +++ b/package.json @@ -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",