carto
Version:
Mapnik Stylesheet Compiler
31 lines (24 loc) • 740 B
JavaScript
(function(tree) {
tree.Quoted = function Quoted(content) {
this.value = content || '';
};
tree.Quoted.prototype = {
is: 'string',
toString: function(quotes) {
var escapedValue = this.value
.replace(/&/g, '&')
var xmlvalue = escapedValue
.replace(/\'/g, '\\\'')
.replace(/\"/g, '"')
.replace(/</g, '<')
.replace(/\>/g, '>');
return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
},
'ev': function() {
return this;
},
operate: function(env, op, other) {
return new tree.Quoted(tree.operate(op, this.toString(), other.toString(this.contains_field)));
}
};
})(require('../tree'));