25 Commits

Author SHA1 Message Date
Sascha Peilicke
4d63ecfe25 Fix all PEP-8 / flake8 code issues
Drop testscope because it's empty.
2014-02-02 17:35:38 +01:00
Sascha Peilicke
840f3265a3 Don't evaluate expression in 'font: 0/0 a;'
This is the ugliest (but valid) CSS statement since sliced bread and
Bootstrap3 makes use of it in the escaped form: 'font: ~"0/0" a;'. Add
test-cases for both variants and special treatment in Expression.parse.

Oh my...
2013-12-20 11:15:42 +01:00
Sascha Peilicke
780dd21b22 Fix mixin guard comparison operator list
The operator list includes "=<", but not "<>", "!=" or "<=". Properly
adjust test cases and drop occurences of invalid operators. Raise a
syntax error if an unknown operator is used. See
http://lesscss.org/#-pattern-matching-and-guard-expressions
2013-12-18 13:51:45 +01:00
Sascha Peilicke
57517bd017 Use operator module everywhere
Much cleaner than using getattr().

Fixes issue #13
2013-08-12 14:49:04 +02:00
Sascha Peilicke
833d887789 Really fix rounding errors
The result of str(float) was changed with Python3:
% python
Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
>>> repr(1.1*1.1)
'1.2100000000000002'
>>> str(1.1*1.1)
'1.21'
% python3
Python 3.3.0 (default, Oct 01 2012, 09:13:30) [GCC] on linux
>>> repr(1.1*1.1)
'1.2100000000000002'
>>> str(1.1*1.1)
'1.2100000000000002'

Thus, instead of rounding the resulting CSS, don't use str() but rather
repr() to return the correct value in with_unit().
2013-08-08 18:25:23 +02:00
Sascha Peilicke
d8cd1fa968 Don't switch operands for non-implemented operators.
Bot __truediv__(int, float) and __add__(int, float) raise
NotImplemented, but switching only helps in the case of addition.
Division isn't commutative so simply cast the int to float. Due to this,
lesscpy now generates the same result as lessc in the modified test
case.
2013-08-08 18:25:22 +02:00
Sascha Peilicke
c0a265e146 Fix PEP-8 issues (with autopep8 -a) 2013-07-19 11:22:12 +02:00
robotis
3b594f7217 Better support for python2.x + python3.x 2012-07-19 09:31:18 +00:00
Patrick
0ff5b977ec fix an other utf-8 letter 2012-07-18 17:28:04 -04:00
Patrick
0660c17cd0 trying to fix python2 and utf-8 issues 2012-07-18 17:26:06 -04:00
robotis
ae8536d2b9 Allow mismatched units in expressions 2012-06-25 08:18:49 +00:00
robotis
e671572683 float results from div operations not longer cast to int 2012-06-04 09:14:58 +00:00
robotis
d2d6908450 Return int on .0 floats 2012-06-04 07:59:11 +00:00
jtm
74c7bf0db1 Bug fix 2012-04-04 12:33:49 +00:00
jtm
264babe5b0 checkpoint 2012-04-03 15:13:44 +00:00
jtm
0c6c345375 documentation 2012-04-03 13:36:08 +00:00
jtm
26ffa97770 parse guard expressions 2012-03-24 18:33:19 +00:00
jtm
f7cdd98643 checkpoint colors 2012-03-10 16:27:14 +00:00
jtm
1799f482bc checkpoint nested 2012-02-26 17:04:50 +00:00
jtm
5532eb88ee checkpoint expressions 2012-02-26 15:50:07 +00:00
jtm
72c648e1e9 checkpoint 2012-02-26 11:19:10 +00:00
jtm
d9ebf7930f Refactor work 2012-02-25 17:34:23 +00:00
jtm
e08bef4d0e Refactor work 2012-02-25 17:08:08 +00:00
jtm
aaedc6bcfc factor 1 2012-02-19 20:38:19 +00:00
robotis
f4ba41cc1d initial commit 2012-01-28 14:52:09 +00:00