better JavaScript evaluation

- support for returning Array values
- Expressions/Values are passed as arrays to JavaScript
- fixed some edge cases
This commit is contained in:
Alexis Sellier
2011-05-17 20:47:42 -04:00
parent 8cdeda8a99
commit 9939ba5076
7 changed files with 47 additions and 20 deletions

View File

@@ -2,6 +2,7 @@
js: 42;
js: 2;
js: "hello world";
js: 1, 2, 3;
title: "node";
ternary: true;
}
@@ -14,4 +15,8 @@
}
.escape-interpol {
width: hello world;
};
}
.arrays {
ary: "1, 2, 3";
ary: "1, 2, 3";
}

View File

@@ -2,13 +2,14 @@
js: `42`;
js: `1 + 1`;
js: `"hello world"`;
js: `[1, 2, 3]`;
title: `process.title`;
ternary: `(1 + 1 == 2 ? true : false)`;
}
.scope {
@foo: 42;
var: `this.foo.toJS()`;
escaped: e(`2 + 5 + 'px'`);
escaped: ~`2 + 5 + 'px'`;
}
.vars {
@var: `4 + 4`;
@@ -16,5 +17,11 @@
}
.escape-interpol {
@world: "world";
width: ~`"hello" + " " + "@{world}"`;
width: ~`"hello" + " " + @{world}`;
}
.arrays {
@ary: 1, 2, 3;
@ary2: 1 2 3;
ary: `@{ary}.join(', ')`;
ary: `@{ary2}.join(', ')`;
}