diff --git a/lib/carto/parser.js b/lib/carto/parser.js
index 13ef3bc..82a47fd 100644
--- a/lib/carto/parser.js
+++ b/lib/carto/parser.js
@@ -806,7 +806,7 @@ carto.Parser = function Parser(env) {
if (! $('[')) return;
if (key = $(/^[a-zA-Z0-9-_]+/) || $(this.entities.quoted)) {
if ((op = $(this.entities.comparison)) &&
- (val = $(this.entities.quoted) || $(/^[\w-\.]+/))) {
+ (val = $(this.entities.quoted) || $(this.entities.variable) || $(/^[\w-\.]+/))) {
if (! $(']')) return;
return new tree.Filter(key, op, val, memo);
}
diff --git a/lib/carto/tree/filter.js b/lib/carto/tree/filter.js
index 6ee29b8..bc9257a 100644
--- a/lib/carto/tree/filter.js
+++ b/lib/carto/tree/filter.js
@@ -41,6 +41,7 @@ var opXML = {
};
tree.Filter.prototype.toXML = function(env) {
+ if (this.val.eval) this._val = this.val.eval(env);
if (this._key) var key = this._key.toString(this._key.is == 'string');
if (this._val) var val = this._val.toString(this._val.is == 'string');
diff --git a/lib/carto/tree/layer.js b/lib/carto/tree/layer.js
index 6a6c532..3689140 100644
--- a/lib/carto/tree/layer.js
+++ b/lib/carto/tree/layer.js
@@ -10,8 +10,8 @@ tree.Layer = function Layer(obj) {
tree.Layer.prototype.toXML = function() {
var dsoptions = [];
for (var i in this.datasource) {
- dsoptions.push('' +
- this.datasource[i] + '');
+ dsoptions.push('');
}
return '
-