improved mustache string matching

This commit is contained in:
2010-03-15 13:48:21 +02:00
parent ae27ad890c
commit 89a146d85a

View File

@@ -299,7 +299,7 @@
$.fn.suggest_results.mustache = function(string, data){ $.fn.suggest_results.mustache = function(string, data){
if (typeof(string) === "string" && typeof(data) === "object") { if (typeof(string) === "string" && typeof(data) === "object") {
for (var key in data) { for (var key in data) {
string = string.replace(new RegExp("{{" + key + "}}", "g"), data[key]); string = string.replace(new RegExp("{{\\s*" + key + "\\s*}}", "g"), data[key]);
} }
}; };
return string; return string;