Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
fix #27. "0" character not evaluated
Browse files Browse the repository at this point in the history
  • Loading branch information
oyejorge committed Dec 27, 2013
1 parent 33fb9d4 commit 561ad24
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 35 deletions.
6 changes: 4 additions & 2 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ public function getCss(){
//obj($root);

self::$has_extends = false;

$evaldRoot = $root->compile($this->env);


$joinSelector = new Less_Visitor_joinSelector();
$joinSelector->run($evaldRoot);

Expand Down Expand Up @@ -1247,15 +1249,15 @@ private function parseElement(){
$e = $this->match( array('/\\G(?:\d+\.\d+|\d+)%/', '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/',
'#*', '#&', 'parseAttribute', '/\\G\([^()@]+\)/', '/\\G[\.#](?=@)/', 'parseEntitiesVariableCurly') );

if( !$e ){
if( !is_null($e) ){
if( $this->MatchChar('(') ){
if( ($v = $this->parseSelector()) && $this->MatchChar(')') ){
$e = $this->Less_Tree_Paren( $v);
}
}
}

if ($e) {
if( !is_null($e) ){
return $this->Less_Tree_Element( $c, $e, $this->pos, $this->env->currentFileInfo);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Less/Tree/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct($combinator, $value, $index = null, $currentFileInfo
$combinator = new Less_Tree_Combinator($combinator);
}

if( $value ){
if( !is_null($value) ){
$this->value = $value;
}

Expand Down
35 changes: 5 additions & 30 deletions test/Fixtures/less.js/less/a.less
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@

.replace.replace,
.c.replace + .replace {
.replace{
prop: copy-paste-replace;
}
}
.rep_ace:extend(.replace.replace .replace) {}


/*
.a > .d,
.z .y{
color: black;
}
.f:extend(.a) {}
.g:extend(.d) {}
.h:extend(.z) {}
.i:extend(.y) {}
.b:extend(.a > .d, .z) {}
.c.e:extend(.b) {}
*/

/*
.i.j:extend(.g all) {
color: white;
}
.k:extend(.i all) {}
.l:extend(.j all) {}
*/
0, 1, 2, 3, 4 {
x-& {
p: v;
}
}
8 changes: 6 additions & 2 deletions test/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function testLessJsCssGeneration($dir, $less, $css){

$options = array();
$options['compress'] = $this->compress;
$options['cache_dir'] = $this->cache_dir;
$options['cache_method'] = 'php';
//$options['cache_dir'] = $this->cache_dir;
//$options['cache_method'] = 'php';



Expand Down Expand Up @@ -472,6 +472,10 @@ static function showError($errno, $errmsg, $filename, $linenum, $vars){
function obj($mixed){
static $objects = array();
global $obj_buffer;
if( empty($obj_buffer) ){
$obj_buffer = "----make sure caching is turned off----\n";
}

static $level = 0;
$output = '';

Expand Down

0 comments on commit 561ad24

Please sign in to comment.