tomyeh / ZUSS

An extension to CSS providing mixins, nested rules, conditional content, variables and seamless Java integration.
http://books.zkoss.org/wiki/ZUSS_Reference
19 stars 5 forks source link

Issues with negative Numbers and Sizes #25

Open laeubi opened 9 years ago

laeubi commented 9 years ago

I'm facing several issues with negative numbers, eg top: -@VARIABLE outputes top: - 2.5mm; (there is a space betwenn the minus sign an the value)

Using top: @eval(-1*@VARIABLE) outputs top: 2.5mm

Using top: @eval(-@VARIABLE) outputs org.zkoss.zuss.ZussException: Unable to negate a size, 2.5mm

From the source I can't see why it should not be possible to negate a size (since it's an ordinary number with a unit), so thin can be added. Another strange thing is that the negate operator only negates sizes and colors but not Numbers.

laeubi commented 9 years ago

Testcase

@VARIABLE: 2.5mm;

div1 {
    top: -@VARIABLE;
}
div2 {
    top: @eval(-1*@VARIABLE);
}
div 3 {
    top: @eval(-@VARIABLE);
}
laeubi commented 9 years ago

I created a pull request that fixes case 2 and 3, @tomyeh do you have any cahnce in looking at case 1? I currently can't see where to start to debugg that problem.