Skip to content

Commit f6929c7

Browse files
committed
Keep syntax changes out of master, see 0.3.0 branch
This reverts commit c546803.
1 parent 3830761 commit f6929c7

File tree

6 files changed

+55
-14
lines changed

6 files changed

+55
-14
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# lessphp v0.3.0-dev
1+
# lessphp v0.2.0
22
#### <http://leafo.net/lessphp>
33

4-
`lessphp` is a compiler for LESS written in PHP.
4+
`lessphp` is a compiler for LESS written in php.
55
For a complete description of the language see <http://leafo.net/lessphp/docs/>
66

77
### How to use in your php project

docs/docs.md

+22
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,28 @@ browsers:
265265
.rounded-corners(14px);
266266
}
267267

268+
Take note of the default argument, which makes specifying that argument optional.
269+
270+
Because CSS values can contain `,`, the argument delimiter is a `;`.
271+
272+
.box-shadow(@props) {
273+
box-shadow: @props;
274+
-webkit-box-shadow: @props;
275+
-moz-box-shadow: @props;
276+
}
277+
278+
.size(@width; @height; @padding: 8px) {
279+
width: @width - 2 * @padding;
280+
height: @height - 2 * @padding;
281+
padding: @padding;
282+
}
283+
284+
.box {
285+
.box-shadow(5px 5px 8px red, -4px -4px 8px blue); // all one argument
286+
.size(400px;200px) // multiple argument:
287+
}
288+
289+
268290
If you have a mixin that doesn't have any arguments, but you don't want it to
269291
show up in the output, give it a blank argument list:
270292

lessc.inc.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,13 @@ function color(&$out) {
631631
}
632632

633633
// consume a list of property values delimited by ; and wrapped in ()
634-
function argumentValues(&$args, $delim = ',') {
634+
function argumentValues(&$args, $delim = ';') {
635635
$s = $this->seek();
636636
if (!$this->literal('(')) return false;
637637

638638
$values = array();
639639
while (true) {
640-
if ($this->expressionList($value)) $values[] = $value;
640+
if ($this->propertyValue($value)) $values[] = $value;
641641
if (!$this->literal($delim)) break;
642642
else {
643643
if ($value == null) $values[] = null;
@@ -656,14 +656,14 @@ function argumentValues(&$args, $delim = ',') {
656656

657657
// consume an argument definition list surrounded by ()
658658
// each argument is a variable name with optional value
659-
function argumentDef(&$args, $delim = ',') {
659+
function argumentDef(&$args, $delim = ';') {
660660
$s = $this->seek();
661661
if (!$this->literal('(')) return false;
662662

663663
$values = array();
664664
while ($this->variable($vname)) {
665665
$arg = array($vname);
666-
if ($this->assign() && $this->expressionList($value)) {
666+
if ($this->assign() && $this->propertyValue($value)) {
667667
$arg[] = $value;
668668
// let the : slide if there is no value
669669
}

tests/inputs/mixin_functions.less

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
@outer: 10px;
3-
@class(@var:22px, @car: 400px + @outer) {
3+
@class(@var:22px; @car: 400px + @outer) {
44
margin: @var;
55
height: @car;
66
}
@@ -21,19 +21,19 @@
2121
body {
2222
.class(2.0em);
2323
@group > @f(red);
24-
@class(10px, 10px + 2);
24+
@class(10px; 10px + 2);
2525
@group > .cool;
2626
}
2727

2828

29-
@lots(@a: 10px, @b: 20px, @c: 30px, @d: 40px, @e: 4px, @f:3px, @g:2px, @h: 1px) {
29+
@lots(@a: 10px; @b: 20px; @c: 30px; @d: 40px; @e: 4px; @f:3px; @g:2px; @h: 1px) {
3030
padding: @a @b @c @d;
3131
margin: @e @f @g @h;
3232
}
3333

3434
.skip_args {
35-
@class(,12px);
36-
@lots(,,,88px,,12px);
37-
@group > @f(red,,,,);
35+
@class(;12px);
36+
@lots(;;;88px;;12px);
37+
@group > @f(red;;;;);
3838
}
3939

tests/inputs/site_demos.less

+16-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ nested-rules {
7575
}
7676
}
7777

78+
accessors {
79+
#defaults {
80+
@width: 960px;
81+
@color: black;
82+
}
83+
84+
.article { color: #294366; }
85+
86+
.comment {
87+
width: #defaults[@width];
88+
color: .article['color'];
89+
}
90+
}
91+
7892
namespaces {
7993
#bundle {
8094
.button {
@@ -92,7 +106,7 @@ namespaces {
92106

93107
mixin-functions {
94108
@outer: 10px;
95-
@class(@var:22px, @car: 400px + @outer) {
109+
@class(@var:22px; @car: 400px + @outer) {
96110
margin: @var;
97111
height: @car;
98112
}
@@ -113,7 +127,7 @@ mixin-functions {
113127
body {
114128
.class(2.0em);
115129
@group > @f(red);
116-
@class(10px, 10px + 2);
130+
@class(10px; 10px + 2);
117131
@group > .cool;
118132
}
119133
}

tests/outputs/site_demos.css

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ nested-rules #header { color:black; }
3232
nested-rules #header .navigation { font-size:12px; }
3333
nested-rules #header .logo { width:300px; }
3434
nested-rules #header .logo:hover { text-decoration:none; }
35+
accessors .article { color:#294366; }
36+
accessors .comment {
37+
width:960px;
38+
color:#294366;
39+
}
3540
namespaces #bundle .button {
3641
display:block;
3742
border:1px solid black;

0 commit comments

Comments
 (0)