Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
-
Property svn:executable set to
*
|
File size:
913 bytes
|
Line | |
---|
1 | (function (tree) { |
---|
2 | |
---|
3 | tree.Quoted = function (str, content, escaped, i) { |
---|
4 | this.escaped = escaped; |
---|
5 | this.value = content || ''; |
---|
6 | this.quote = str.charAt(0); |
---|
7 | this.index = i; |
---|
8 | }; |
---|
9 | tree.Quoted.prototype = { |
---|
10 | toCSS: function () { |
---|
11 | if (this.escaped) { |
---|
12 | return this.value; |
---|
13 | } else { |
---|
14 | return this.quote + this.value + this.quote; |
---|
15 | } |
---|
16 | }, |
---|
17 | eval: function (env) { |
---|
18 | var that = this; |
---|
19 | var value = this.value.replace(/`([^`]+)`/g, function (_, exp) { |
---|
20 | return new(tree.JavaScript)(exp, that.index, true).eval(env).value; |
---|
21 | }).replace(/@\{([\w-]+)\}/g, function (_, name) { |
---|
22 | var v = new(tree.Variable)('@' + name, that.index).eval(env); |
---|
23 | return v.value || v.toCSS(); |
---|
24 | }); |
---|
25 | return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index); |
---|
26 | } |
---|
27 | }; |
---|
28 | |
---|
29 | })(require('less/tree')); |
---|
Note: See
TracBrowser
for help on using the repository browser.