Skip to content

Commit 1f96a06

Browse files
committed
Allow spaces in template variables
1 parent 0c55d5a commit 1f96a06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/templates/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
JSONEditor.defaults.templates["default"] = function() {
22
return {
33
compile: function(template) {
4-
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g);
4+
var matches = template.match(/{{\s*([a-zA-Z0-9\-_ \.]+)\s*}}/g);
55
var l = matches.length;
66

77
// Shortcut if the template contains no variables
@@ -11,7 +11,7 @@ JSONEditor.defaults.templates["default"] = function() {
1111
// This drastically speeds up template execution
1212
var replacements = [];
1313
var get_replacement = function(i) {
14-
var p = matches[i].replace(/[{}\s]+/g,'').split('.');
14+
var p = matches[i].replace(/[{}]+/g,'').trim().split('.');
1515
var n = p.length;
1616
var func;
1717

0 commit comments

Comments
 (0)