Sha256: 2c9233f66a0f8d24d0bbafaf540e2e360c978be731d0c3830f5affc29d94c0a5

Contents?: true

Size: 913 Bytes

Versions: 8

Compression:

Stored size: 913 Bytes

Contents

(function (tree) {

tree.Quoted = function (str, content, escaped, i) {
    this.escaped = escaped;
    this.value = content || '';
    this.quote = str.charAt(0);
    this.index = i;
};
tree.Quoted.prototype = {
    toCSS: function () {
        if (this.escaped) {
            return this.value;
        } else {
            return this.quote + this.value + this.quote;
        }
    },
    eval: function (env) {
        var that = this;
        var value = this.value.replace(/`([^`]+)`/g, function (_, exp) {
            return new(tree.JavaScript)(exp, that.index, true).eval(env).value;
        }).replace(/@\{([\w-]+)\}/g, function (_, name) {
            var v = new(tree.Variable)('@' + name, that.index).eval(env);
            return v.value || v.toCSS();
        });
        return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index);
    }
};

})(require('less/tree'));

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
less-2.0.7 lib/less/js/lib/less/tree/quoted.js
less-2.0.6 lib/less/js/lib/less/tree/quoted.js
less-2.0.5 lib/less/js/lib/less/tree/quoted.js
less-2.0.4 lib/less/js/lib/less/tree/quoted.js
less-2.0.3 lib/less/js/lib/less/tree/quoted.js
less-2.0.2 lib/less/js/lib/less/tree/quoted.js
less-2.0.1 lib/less/js/lib/less/tree/quoted.js
less-2.0.0 lib/less/js/lib/less/tree/quoted.js