Moved to lesscpy.__version__ and use it in setup.py. Also, don't put the
whole license text into the 'license' tag but rather the short form
'MIT'. The license file is part of the source distribution already and
was added to package_data (so that it ends up somewhere when 'setup.py
install' is invoked).
In essence, tests are not an importable submodule anymore but an
independent piece of code that won't be installed in a user's
site-packages directory.
We still have subtle differences that are semantically equivalent:
- #fff vs. #ffffff
- 0.0 vs .0
- 0 vs 0%
- property sort order (and identation for -moz-$BLA)
There are still some other issues to fix, disable the bootstrap3 test
therefore to let the testsuite pass.
Let'S do it by example:
.ident_a, .ident_b {
& + & + & { color: red; }
}
We have to generate all permutations of the parent identifier list and
the amount of ampersand child identifiers. In the above case, the
exploded identifier list has ident_count**ampersand_count entries (8).
As a bonus, we get the same identifier sort order as lessc does.
Conflicts:
lesscpy/plib/identifier.py
Including double-nested queries which are used (not only) by bootstrap3.
Triple-nested (or more) media queries are currently not supported. Added
several tests.
See http://www.lesscss.org/#-nested-media-queries
The lexer now identifies media queries in @media ... {} and
@import ... ; statements. For that, two new states "mediaquery" and
import" where added. The parser uses those to implement the CSS3 media
query BNF (www.w3.org/TR/css3-mediaqueries). Overall test coverage
increased.
The previous test case was generated by lessc (upstream). Meanwhile,
lesscpy also parses it but generates slightly different (though
functionally equivalent) output. Therefore adjust the desired output so
that this test finally passes.
The alpha value can either be a number in the range 0-1 or a percentage
(0-100%). Alpha values greater than 1 are simply dropped. Compare with
the rgba() function definition at http://lesscss.org/#reference.
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...
Bail out after recursing 64 times into Deferred.parse and raise syntax
error for missing declaration to provide a meaningful error message.
Otherwise the code loops until the interpreter stack end (max
recursion depth).
If the parsed block contents contains only LESS variable definitions,
the block should not be renderend. Previously this was implemented by
not returning self from Variable.parse() (contrary to it's docstring and
other plib classes). The real fix is to just check for the above
condition and return self again.
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
Function argument lists are missing whitespaces after each comma with
the currenct escaped strings code. However, the minified version had
commas before which wasn't any better.
Likely an easy fix somewhere but shouldn't block now.
I don't think it makes sense to test for that just now. The function
call parsing should be significantly enhanced before.
Changed to ~"-Some(#thing)" instead.
'rect' is a DOM element and occurs as a function. Currently, the parser
doesn't have a list of valid function names but uses css_dom elements
(and some others) to identify function calls.
Therefore the lexer got additional state tracking a while ago. This
turned out to wrongly work on constructs such as "button::-moz-$FOO,
input::-moz-$BAR", where 'input' was marked as 'css_ident' rather than
'css_dom'. This is fixed by resetting the 'in_property_decl' state
variable after a comma.
Quote from lesscss.org: "prior to LESS 1.3.1 a (~"@{name}") type of
selector was supported. Support for this will be removed in 1.4.0.".
Meanwhile, interpolated selectors look like .@{name}.
For this, the lexer needed another state. Promote literals '{}' to
tokens to be able to drop the 'istring' state when '.foo{' occurs
(rather than '.foo {').
To be used inside general_sibling_selector (e.g. 'a ~ b { ... }')
instead of the literal '~'. Necessary since we had to remove the literal
from the lexer in order to tokenize ~"..." and ~'...'.
Ordinary CSS strings may contain @{...}-style variables. Here are some
examples:
content: "@{breadcrumb-separator}\00a0";
background-image: url("@{file-2x}");
.col(@index + 1, ~"@{list}, @{item}");
The lexer catches Microsoft-specific function calls such "progid:..."
and "DX.Transform..." in the css_ms_filter token class. It should be
used only as the function for "fcall" constructs in the parser.
The following constructs are escapes: ~"..." and ~'...'. Inside, only
@{...} is a LESS variable, @foo is not! To express that, the lexer needs
to additional states ('lessstringquotes' and 'lessstringapostrophe') and
some parsing rules special to those states. The literal '~' had to be
promoted to token too. Now, instead as marking the complete LESS string
as 'less_string' token, the lexer properly tokenizes it's content which
in turn the parser can properly evaluate.
Includes a minor bug fix, t_less_variable() wasn't ever used because
t_css_ident already captured them. This part was removed from
t_css_ident becaus it's much easier to overwrite t_less_variable in lexer
states.