Allow any casing for functions. Fixes #1168

This commit is contained in:
Luke Page
2013-02-15 22:15:08 +00:00
parent e675892ba4
commit 178696d141
3 changed files with 10 additions and 4 deletions

View File

@@ -25,13 +25,14 @@ tree.Call.prototype = {
// The function should receive the value, not the variable.
//
eval: function (env) {
var args = this.args.map(function (a) { return a.eval(env) }),
var args = this.args.map(function (a) { return a.eval(env); }),
nameLC = this.name.toLowerCase(),
result, func;
if (this.name in tree.functions) { // 1.
if (nameLC in tree.functions) { // 1.
try {
func = new tree.functionCall(env, this.rootpath);
result = func[this.name].apply(func, args);
result = func[nameLC].apply(func, args);
if (result != null) {
return result;
}
@@ -45,7 +46,7 @@ tree.Call.prototype = {
// 2.
return new(tree.Anonymous)(this.name +
"(" + args.map(function (a) { return a.toCSS(env) }).join(', ') + ")");
"(" + args.map(function (a) { return a.toCSS(env); }).join(', ') + ")");
},
toCSS: function (env) {

View File

@@ -87,6 +87,8 @@
shade: #686868;
shade-full: #000000;
shade-percent: #686868;
fade-out: rgba(255, 0, 0, 0.95);
fade-in: rgba(255, 0, 0, 0.9500000000000001);
hsv: #4d2926;
hsva: rgba(77, 40, 38, 0.2);
mix: #ff3300;

View File

@@ -93,6 +93,9 @@
shade: shade(#777777, 13);
shade-full: shade(#777777, 100);
shade-percent: shade(#777777, 13%);
fade-out: fadeOut(red, 5%); // support fadeOut and fadeout
fade-in: fadein(fadeout(red, 10%), 5%);
hsv: hsv(5, 50%, 30%);
hsva: hsva(3, 50%, 30%, 0.2);