Comparing version 1.0.0 to 1.0.2
@@ -16,3 +16,3 @@ (function(global) { | ||
function rendy(templ, data) { | ||
var str, regExp, | ||
var str, regExp, expr, | ||
result = templ; | ||
@@ -26,8 +26,9 @@ | ||
str = data[param]; | ||
regExp = RegExp('{{\\s*' + param + '\\s*}}', 'g'); | ||
expr = '{{\\s*' + param + '\\s*}}'; | ||
regExp = RegExp(expr, 'g'); | ||
result = result.replace(regExp, str); | ||
}); | ||
if (result.indexOf('{{')) | ||
result.replace(/{{\s*.*\s*}}/, ''); | ||
if (~result.indexOf('{{')) | ||
result = result.replace(/{{\s*.*\s*}}/, ''); | ||
@@ -34,0 +35,0 @@ return result; |
{ | ||
"name": "rendy", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "simple template engine", | ||
@@ -5,0 +5,0 @@ "main": "lib/rendy.js", |
@@ -18,3 +18,3 @@ # Rendy | ||
<script> | ||
Tmpl = 'hello {{ who }}'; | ||
Tmpl = 'hello {{ where }}'; | ||
result = rendy(Tmpl, { | ||
@@ -21,0 +21,0 @@ where: 'in browser' |
3643
6
35