cloudhead-less 1.0.6 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/less.gemspec +3 -2
- data/lib/less/engine/less.tt +26 -7
- data/lib/less/engine/nodes/function.rb +1 -7
- data/lib/less/engine/nodes/literal.rb +62 -27
- data/lib/less/engine/nodes/property.rb +6 -1
- data/lib/less/engine/nodes.rb +1 -1
- data/lib/less/engine/parser.rb +304 -108
- data/spec/css/colors-1.0.css +10 -0
- data/spec/css/css-1.0.css +2 -0
- data/spec/css/operations-1.0.css +2 -2
- data/spec/css/scope-1.0.css +1 -1
- data/spec/css/whitespace-1.0.css +1 -0
- data/spec/engine_spec.rb +5 -1
- data/spec/less/colors-1.0.less +30 -0
- data/spec/less/css-1.0.less +8 -0
- data/spec/less/operations-1.0.less +2 -2
- data/spec/less/whitespace-1.0.less +5 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.9
|
data/less.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{less}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["cloudhead"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-15}
|
10
10
|
s.default_executable = %q{lessc}
|
11
11
|
s.description = %q{LESS is leaner CSS}
|
12
12
|
s.email = %q{self@cloudhead.net}
|
@@ -129,6 +129,7 @@ Gem::Specification.new do |s|
|
|
129
129
|
"spec/command_spec.rb",
|
130
130
|
"spec/css/accessors-1.0.css",
|
131
131
|
"spec/css/big-1.0.css",
|
132
|
+
"spec/css/colors-1.0.css",
|
132
133
|
"spec/css/comments-1.0.css",
|
133
134
|
"spec/css/css-1.0.css",
|
134
135
|
"spec/css/functions-1.0.css",
|
data/lib/less/engine/less.tt
CHANGED
@@ -113,7 +113,7 @@ grammar Less
|
|
113
113
|
# An operation or compound value
|
114
114
|
#
|
115
115
|
rule expression
|
116
|
-
entity (operator / S) expression <Builder> / entity
|
116
|
+
entity (operator / S / WS) expression <Builder> / entity
|
117
117
|
end
|
118
118
|
|
119
119
|
#
|
@@ -165,7 +165,7 @@ grammar Less
|
|
165
165
|
# div / .class / #id / input[type="text"] / lang(fr)
|
166
166
|
#
|
167
167
|
rule element
|
168
|
-
(class_id / tag / ident) attribute* ('(' ident ')')? / '@media' / '@font-face'
|
168
|
+
(class_id / tag / ident) attribute* ('(' ident? attribute* ')')? / attribute+ / '@media' / '@font-face'
|
169
169
|
end
|
170
170
|
|
171
171
|
rule class_id
|
@@ -176,7 +176,7 @@ grammar Less
|
|
176
176
|
# [type="text"]
|
177
177
|
#
|
178
178
|
rule attribute
|
179
|
-
'[' tag ([
|
179
|
+
'[' tag ([|~*]? '=') (tag / string) ']' / '[' (tag / string) ']'
|
180
180
|
end
|
181
181
|
|
182
182
|
rule class
|
@@ -290,9 +290,9 @@ grammar Less
|
|
290
290
|
# Color
|
291
291
|
#
|
292
292
|
rule color
|
293
|
-
'#'
|
293
|
+
'#' rgb {
|
294
294
|
def build env
|
295
|
-
env.identifiers.last << Node::Color.new(
|
295
|
+
env.identifiers.last << Node::Color.new(*rgb.build)
|
296
296
|
end
|
297
297
|
} / fn:(('hsl'/'rgb') 'a'?) '(' arguments ')' {
|
298
298
|
def build env
|
@@ -302,10 +302,25 @@ grammar Less
|
|
302
302
|
}
|
303
303
|
end
|
304
304
|
|
305
|
-
|
306
|
-
|
305
|
+
#
|
306
|
+
# 00ffdd / 0fd
|
307
|
+
#
|
308
|
+
rule rgb
|
309
|
+
r:(hex hex) g:(hex hex) b:(hex hex) {
|
310
|
+
def build
|
311
|
+
[r.text_value, g.text_value, b.text_value]
|
312
|
+
end
|
313
|
+
} / r:hex g:hex b:hex {
|
314
|
+
def build
|
315
|
+
[r.text_value, g.text_value, b.text_value].map {|c| c * 2 }
|
316
|
+
end
|
317
|
+
}
|
307
318
|
end
|
308
319
|
|
320
|
+
rule hex
|
321
|
+
[a-fA-F0-9]
|
322
|
+
end
|
323
|
+
|
309
324
|
#
|
310
325
|
# Functions and arguments
|
311
326
|
#
|
@@ -367,6 +382,10 @@ grammar Less
|
|
367
382
|
[\n ]*
|
368
383
|
end
|
369
384
|
|
385
|
+
rule WS
|
386
|
+
[\n ]+
|
387
|
+
end
|
388
|
+
|
370
389
|
# Non-space char
|
371
390
|
rule ns
|
372
391
|
![ ;\n] .
|
@@ -15,13 +15,7 @@ module Less
|
|
15
15
|
# RGBA to Node::Color
|
16
16
|
#
|
17
17
|
def rgba *rgba
|
18
|
-
|
19
|
-
hex = [r, g, b].inject("") do |str, c|
|
20
|
-
c = c.to_i.to_s(16)
|
21
|
-
c = '0' + c if c.length < 2
|
22
|
-
str + c
|
23
|
-
end
|
24
|
-
Node::Color.new hex, a
|
18
|
+
Node::Color.new *rgba
|
25
19
|
end
|
26
20
|
|
27
21
|
#
|
@@ -11,44 +11,79 @@ module Less
|
|
11
11
|
#
|
12
12
|
# rgb(255, 0, 0) #f0f0f0
|
13
13
|
#
|
14
|
-
class Color
|
14
|
+
class Color
|
15
15
|
include Literal
|
16
|
-
attr_reader :
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
attr_reader :r, :g, :b, :a
|
17
|
+
|
18
|
+
def initialize(r, g, b, a = 1.0)
|
19
|
+
r, g, b = [r, g, b].map {|c| c.is_a?(::String) ? c.to_i(16) : c }
|
20
|
+
@r, @g, @b, @a = normalize(r), normalize(g), normalize(b), normalize(a, 1.0)
|
21
|
+
end
|
22
|
+
|
23
|
+
def alpha(v)
|
24
|
+
self.class.new(r,g,b,v)
|
25
|
+
end
|
26
|
+
|
27
|
+
def rgb
|
28
|
+
[r, g, b]
|
29
|
+
end
|
30
|
+
|
31
|
+
def operate op, other
|
32
|
+
if other.is_a? Numeric
|
33
|
+
self.class.new *self.rgb.map {|c| c.send(op, other) }, @a
|
24
34
|
else
|
25
|
-
|
35
|
+
self.class.new *self.rgb.zip(other.rgb).map {|a, b| a.send(op, b) }, @a
|
26
36
|
end
|
27
|
-
super @color.to_i
|
28
37
|
end
|
29
|
-
|
30
|
-
def
|
31
|
-
|
38
|
+
|
39
|
+
def + other
|
40
|
+
operate :+, other
|
32
41
|
end
|
33
|
-
|
34
|
-
def
|
35
|
-
|
36
|
-
|
42
|
+
|
43
|
+
def - other
|
44
|
+
operate :-, other
|
45
|
+
end
|
46
|
+
|
47
|
+
def * other
|
48
|
+
operate :*, other
|
49
|
+
end
|
50
|
+
|
51
|
+
def / other
|
52
|
+
operate :/, other
|
53
|
+
end
|
54
|
+
|
55
|
+
def coerce other
|
56
|
+
return self, other
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_s
|
60
|
+
if a < 1.0
|
61
|
+
"rgba(#{r.to_i}, #{g.to_i}, #{b.to_i}, #{a})"
|
37
62
|
else
|
38
|
-
|
39
|
-
'0' * (6 - hex.length) + hex
|
63
|
+
"#%02x%02x%02x" % [r,g,b]
|
40
64
|
end
|
41
65
|
end
|
42
|
-
|
43
|
-
def
|
44
|
-
|
66
|
+
|
67
|
+
def inspect
|
68
|
+
if a < 1.0
|
69
|
+
"rgba(#{r}, #{g}, #{b}, #{a})"
|
70
|
+
else
|
71
|
+
"rgb(#{r}, #{g}, #{b})"
|
72
|
+
end
|
45
73
|
end
|
46
|
-
|
47
|
-
def
|
48
|
-
|
74
|
+
|
75
|
+
def to_css
|
76
|
+
to_s
|
49
77
|
end
|
50
78
|
|
51
|
-
def
|
79
|
+
def to_ruby
|
80
|
+
"Color.new(#{r},#{g},#{b},#{a})"
|
81
|
+
end
|
82
|
+
|
83
|
+
protected
|
84
|
+
def normalize(v, max = 255, min = 0)
|
85
|
+
[[min, v].max, max].min
|
86
|
+
end
|
52
87
|
end
|
53
88
|
|
54
89
|
#
|
@@ -94,7 +94,12 @@ module Less
|
|
94
94
|
|
95
95
|
unless ruby.include? nil
|
96
96
|
if entity
|
97
|
-
|
97
|
+
result = eval(ruby.join)
|
98
|
+
if result.is_a? Entity
|
99
|
+
result
|
100
|
+
else
|
101
|
+
entity.class.new(*result, *(unit if entity.class == Node::Number))
|
102
|
+
end
|
98
103
|
else
|
99
104
|
first
|
100
105
|
end
|
data/lib/less/engine/nodes.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
2
|
|
3
3
|
require 'engine/nodes/entity'
|
4
|
+
require 'engine/nodes/function'
|
4
5
|
require 'engine/nodes/element'
|
5
6
|
require 'engine/nodes/property'
|
6
7
|
require 'engine/nodes/literal'
|
7
|
-
require 'engine/nodes/function'
|
8
8
|
require 'engine/nodes/selector'
|
data/lib/less/engine/parser.rb
CHANGED
@@ -1265,14 +1265,19 @@ module Less
|
|
1265
1265
|
if r5
|
1266
1266
|
r3 = r5
|
1267
1267
|
else
|
1268
|
-
|
1269
|
-
|
1268
|
+
r6 = _nt_WS
|
1269
|
+
if r6
|
1270
|
+
r3 = r6
|
1271
|
+
else
|
1272
|
+
@index = i3
|
1273
|
+
r3 = nil
|
1274
|
+
end
|
1270
1275
|
end
|
1271
1276
|
end
|
1272
1277
|
s1 << r3
|
1273
1278
|
if r3
|
1274
|
-
|
1275
|
-
s1 <<
|
1279
|
+
r7 = _nt_expression
|
1280
|
+
s1 << r7
|
1276
1281
|
end
|
1277
1282
|
end
|
1278
1283
|
if s1.last
|
@@ -1285,9 +1290,9 @@ module Less
|
|
1285
1290
|
if r1
|
1286
1291
|
r0 = r1
|
1287
1292
|
else
|
1288
|
-
|
1289
|
-
if
|
1290
|
-
r0 =
|
1293
|
+
r8 = _nt_entity
|
1294
|
+
if r8
|
1295
|
+
r0 = r8
|
1291
1296
|
else
|
1292
1297
|
@index = i0
|
1293
1298
|
r0 = nil
|
@@ -1655,10 +1660,6 @@ module Less
|
|
1655
1660
|
end
|
1656
1661
|
|
1657
1662
|
module Element0
|
1658
|
-
def ident
|
1659
|
-
elements[1]
|
1660
|
-
end
|
1661
|
-
|
1662
1663
|
end
|
1663
1664
|
|
1664
1665
|
module Element1
|
@@ -1716,17 +1717,35 @@ module Less
|
|
1716
1717
|
end
|
1717
1718
|
s9 << r10
|
1718
1719
|
if r10
|
1719
|
-
|
1720
|
+
r12 = _nt_ident
|
1721
|
+
if r12
|
1722
|
+
r11 = r12
|
1723
|
+
else
|
1724
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
1725
|
+
end
|
1720
1726
|
s9 << r11
|
1721
1727
|
if r11
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
+
s13, i13 = [], index
|
1729
|
+
loop do
|
1730
|
+
r14 = _nt_attribute
|
1731
|
+
if r14
|
1732
|
+
s13 << r14
|
1733
|
+
else
|
1734
|
+
break
|
1735
|
+
end
|
1736
|
+
end
|
1737
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
1738
|
+
s9 << r13
|
1739
|
+
if r13
|
1740
|
+
if has_terminal?(')', false, index)
|
1741
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1742
|
+
@index += 1
|
1743
|
+
else
|
1744
|
+
terminal_parse_failure(')')
|
1745
|
+
r15 = nil
|
1746
|
+
end
|
1747
|
+
s9 << r15
|
1728
1748
|
end
|
1729
|
-
s9 << r12
|
1730
1749
|
end
|
1731
1750
|
end
|
1732
1751
|
if s9.last
|
@@ -1754,28 +1773,47 @@ module Less
|
|
1754
1773
|
if r1
|
1755
1774
|
r0 = r1
|
1756
1775
|
else
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1776
|
+
s16, i16 = [], index
|
1777
|
+
loop do
|
1778
|
+
r17 = _nt_attribute
|
1779
|
+
if r17
|
1780
|
+
s16 << r17
|
1781
|
+
else
|
1782
|
+
break
|
1783
|
+
end
|
1784
|
+
end
|
1785
|
+
if s16.empty?
|
1786
|
+
@index = i16
|
1787
|
+
r16 = nil
|
1760
1788
|
else
|
1761
|
-
|
1762
|
-
r13 = nil
|
1789
|
+
r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
|
1763
1790
|
end
|
1764
|
-
if
|
1765
|
-
r0 =
|
1791
|
+
if r16
|
1792
|
+
r0 = r16
|
1766
1793
|
else
|
1767
|
-
if has_terminal?('@
|
1768
|
-
|
1769
|
-
@index +=
|
1794
|
+
if has_terminal?('@media', false, index)
|
1795
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
1796
|
+
@index += 6
|
1770
1797
|
else
|
1771
|
-
terminal_parse_failure('@
|
1772
|
-
|
1798
|
+
terminal_parse_failure('@media')
|
1799
|
+
r18 = nil
|
1773
1800
|
end
|
1774
|
-
if
|
1775
|
-
r0 =
|
1801
|
+
if r18
|
1802
|
+
r0 = r18
|
1776
1803
|
else
|
1777
|
-
@
|
1778
|
-
|
1804
|
+
if has_terminal?('@font-face', false, index)
|
1805
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 10))
|
1806
|
+
@index += 10
|
1807
|
+
else
|
1808
|
+
terminal_parse_failure('@font-face')
|
1809
|
+
r19 = nil
|
1810
|
+
end
|
1811
|
+
if r19
|
1812
|
+
r0 = r19
|
1813
|
+
else
|
1814
|
+
@index = i0
|
1815
|
+
r0 = nil
|
1816
|
+
end
|
1779
1817
|
end
|
1780
1818
|
end
|
1781
1819
|
end
|
@@ -1883,7 +1921,7 @@ module Less
|
|
1883
1921
|
s1 << r3
|
1884
1922
|
if r3
|
1885
1923
|
i4, s4 = index, []
|
1886
|
-
if has_terminal?('[
|
1924
|
+
if has_terminal?('[|~*]', true, index)
|
1887
1925
|
r6 = true
|
1888
1926
|
@index += 1
|
1889
1927
|
else
|
@@ -2658,41 +2696,37 @@ module Less
|
|
2658
2696
|
end
|
2659
2697
|
|
2660
2698
|
i0, s0 = index, []
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2699
|
+
s1, i1 = [], index
|
2700
|
+
loop do
|
2701
|
+
if has_terminal?('[-a-zA-Z]', true, index)
|
2702
|
+
r2 = true
|
2703
|
+
@index += 1
|
2704
|
+
else
|
2705
|
+
r2 = nil
|
2706
|
+
end
|
2707
|
+
if r2
|
2708
|
+
s1 << r2
|
2709
|
+
else
|
2710
|
+
break
|
2711
|
+
end
|
2712
|
+
end
|
2713
|
+
if s1.empty?
|
2714
|
+
@index = i1
|
2665
2715
|
r1 = nil
|
2716
|
+
else
|
2717
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
2666
2718
|
end
|
2667
2719
|
s0 << r1
|
2668
2720
|
if r1
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
end
|
2677
|
-
if r3
|
2678
|
-
s2 << r3
|
2679
|
-
else
|
2680
|
-
break
|
2681
|
-
end
|
2682
|
-
end
|
2683
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2684
|
-
s0 << r2
|
2685
|
-
if r2
|
2686
|
-
i4 = index
|
2687
|
-
r5 = _nt_ns
|
2688
|
-
if r5
|
2689
|
-
r4 = nil
|
2690
|
-
else
|
2691
|
-
@index = i4
|
2692
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2693
|
-
end
|
2694
|
-
s0 << r4
|
2721
|
+
i3 = index
|
2722
|
+
r4 = _nt_ns
|
2723
|
+
if r4
|
2724
|
+
r3 = nil
|
2725
|
+
else
|
2726
|
+
@index = i3
|
2727
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
2695
2728
|
end
|
2729
|
+
s0 << r3
|
2696
2730
|
end
|
2697
2731
|
if s0.last
|
2698
2732
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
@@ -3191,14 +3225,14 @@ module Less
|
|
3191
3225
|
end
|
3192
3226
|
|
3193
3227
|
module Color0
|
3194
|
-
def
|
3228
|
+
def rgb
|
3195
3229
|
elements[1]
|
3196
3230
|
end
|
3197
3231
|
end
|
3198
3232
|
|
3199
3233
|
module Color1
|
3200
3234
|
def build env
|
3201
|
-
env.identifiers.last << Node::Color.new(
|
3235
|
+
env.identifiers.last << Node::Color.new(*rgb.build)
|
3202
3236
|
end
|
3203
3237
|
end
|
3204
3238
|
|
@@ -3242,7 +3276,7 @@ module Less
|
|
3242
3276
|
end
|
3243
3277
|
s1 << r2
|
3244
3278
|
if r2
|
3245
|
-
r3 =
|
3279
|
+
r3 = _nt_rgb
|
3246
3280
|
s1 << r3
|
3247
3281
|
end
|
3248
3282
|
if s1.last
|
@@ -3352,62 +3386,190 @@ module Less
|
|
3352
3386
|
r0
|
3353
3387
|
end
|
3354
3388
|
|
3355
|
-
module
|
3389
|
+
module Rgb0
|
3390
|
+
def hex
|
3391
|
+
elements[0]
|
3392
|
+
end
|
3393
|
+
|
3394
|
+
def hex
|
3395
|
+
elements[1]
|
3396
|
+
end
|
3356
3397
|
end
|
3357
3398
|
|
3358
|
-
|
3399
|
+
module Rgb1
|
3400
|
+
def hex
|
3401
|
+
elements[0]
|
3402
|
+
end
|
3403
|
+
|
3404
|
+
def hex
|
3405
|
+
elements[1]
|
3406
|
+
end
|
3407
|
+
end
|
3408
|
+
|
3409
|
+
module Rgb2
|
3410
|
+
def hex
|
3411
|
+
elements[0]
|
3412
|
+
end
|
3413
|
+
|
3414
|
+
def hex
|
3415
|
+
elements[1]
|
3416
|
+
end
|
3417
|
+
end
|
3418
|
+
|
3419
|
+
module Rgb3
|
3420
|
+
def r
|
3421
|
+
elements[0]
|
3422
|
+
end
|
3423
|
+
|
3424
|
+
def g
|
3425
|
+
elements[1]
|
3426
|
+
end
|
3427
|
+
|
3428
|
+
def b
|
3429
|
+
elements[2]
|
3430
|
+
end
|
3431
|
+
end
|
3432
|
+
|
3433
|
+
module Rgb4
|
3434
|
+
def build
|
3435
|
+
[r.text_value, g.text_value, b.text_value]
|
3436
|
+
end
|
3437
|
+
end
|
3438
|
+
|
3439
|
+
module Rgb5
|
3440
|
+
def r
|
3441
|
+
elements[0]
|
3442
|
+
end
|
3443
|
+
|
3444
|
+
def g
|
3445
|
+
elements[1]
|
3446
|
+
end
|
3447
|
+
|
3448
|
+
def b
|
3449
|
+
elements[2]
|
3450
|
+
end
|
3451
|
+
end
|
3452
|
+
|
3453
|
+
module Rgb6
|
3454
|
+
def build
|
3455
|
+
[r.text_value, g.text_value, b.text_value].map {|c| c * 2 }
|
3456
|
+
end
|
3457
|
+
end
|
3458
|
+
|
3459
|
+
def _nt_rgb
|
3359
3460
|
start_index = index
|
3360
|
-
if node_cache[:
|
3361
|
-
cached = node_cache[:
|
3461
|
+
if node_cache[:rgb].has_key?(index)
|
3462
|
+
cached = node_cache[:rgb][index]
|
3362
3463
|
@index = cached.interval.end if cached
|
3363
3464
|
return cached
|
3364
3465
|
end
|
3365
3466
|
|
3366
|
-
i0
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3467
|
+
i0 = index
|
3468
|
+
i1, s1 = index, []
|
3469
|
+
i2, s2 = index, []
|
3470
|
+
r3 = _nt_hex
|
3471
|
+
s2 << r3
|
3472
|
+
if r3
|
3473
|
+
r4 = _nt_hex
|
3474
|
+
s2 << r4
|
3475
|
+
end
|
3476
|
+
if s2.last
|
3477
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
3478
|
+
r2.extend(Rgb0)
|
3370
3479
|
else
|
3371
|
-
|
3480
|
+
@index = i2
|
3481
|
+
r2 = nil
|
3372
3482
|
end
|
3373
|
-
|
3374
|
-
if
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3483
|
+
s1 << r2
|
3484
|
+
if r2
|
3485
|
+
i5, s5 = index, []
|
3486
|
+
r6 = _nt_hex
|
3487
|
+
s5 << r6
|
3488
|
+
if r6
|
3489
|
+
r7 = _nt_hex
|
3490
|
+
s5 << r7
|
3491
|
+
end
|
3492
|
+
if s5.last
|
3493
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
3494
|
+
r5.extend(Rgb1)
|
3378
3495
|
else
|
3379
|
-
|
3496
|
+
@index = i5
|
3497
|
+
r5 = nil
|
3380
3498
|
end
|
3381
|
-
|
3382
|
-
if
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3389
|
-
r4 = nil
|
3390
|
-
end
|
3391
|
-
if r4
|
3392
|
-
s3 << r4
|
3393
|
-
else
|
3394
|
-
break
|
3395
|
-
end
|
3499
|
+
s1 << r5
|
3500
|
+
if r5
|
3501
|
+
i8, s8 = index, []
|
3502
|
+
r9 = _nt_hex
|
3503
|
+
s8 << r9
|
3504
|
+
if r9
|
3505
|
+
r10 = _nt_hex
|
3506
|
+
s8 << r10
|
3396
3507
|
end
|
3397
|
-
if
|
3398
|
-
|
3399
|
-
|
3508
|
+
if s8.last
|
3509
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
3510
|
+
r8.extend(Rgb2)
|
3400
3511
|
else
|
3401
|
-
|
3512
|
+
@index = i8
|
3513
|
+
r8 = nil
|
3402
3514
|
end
|
3403
|
-
|
3515
|
+
s1 << r8
|
3404
3516
|
end
|
3405
3517
|
end
|
3406
|
-
if
|
3407
|
-
|
3408
|
-
|
3518
|
+
if s1.last
|
3519
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
3520
|
+
r1.extend(Rgb3)
|
3521
|
+
r1.extend(Rgb4)
|
3522
|
+
else
|
3523
|
+
@index = i1
|
3524
|
+
r1 = nil
|
3525
|
+
end
|
3526
|
+
if r1
|
3527
|
+
r0 = r1
|
3528
|
+
else
|
3529
|
+
i11, s11 = index, []
|
3530
|
+
r12 = _nt_hex
|
3531
|
+
s11 << r12
|
3532
|
+
if r12
|
3533
|
+
r13 = _nt_hex
|
3534
|
+
s11 << r13
|
3535
|
+
if r13
|
3536
|
+
r14 = _nt_hex
|
3537
|
+
s11 << r14
|
3538
|
+
end
|
3539
|
+
end
|
3540
|
+
if s11.last
|
3541
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
3542
|
+
r11.extend(Rgb5)
|
3543
|
+
r11.extend(Rgb6)
|
3544
|
+
else
|
3545
|
+
@index = i11
|
3546
|
+
r11 = nil
|
3547
|
+
end
|
3548
|
+
if r11
|
3549
|
+
r0 = r11
|
3550
|
+
else
|
3551
|
+
@index = i0
|
3552
|
+
r0 = nil
|
3553
|
+
end
|
3554
|
+
end
|
3555
|
+
|
3556
|
+
node_cache[:rgb][start_index] = r0
|
3557
|
+
|
3558
|
+
r0
|
3559
|
+
end
|
3560
|
+
|
3561
|
+
def _nt_hex
|
3562
|
+
start_index = index
|
3563
|
+
if node_cache[:hex].has_key?(index)
|
3564
|
+
cached = node_cache[:hex][index]
|
3565
|
+
@index = cached.interval.end if cached
|
3566
|
+
return cached
|
3567
|
+
end
|
3568
|
+
|
3569
|
+
if has_terminal?('[a-fA-F0-9]', true, index)
|
3570
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3571
|
+
@index += 1
|
3409
3572
|
else
|
3410
|
-
@index = i0
|
3411
3573
|
r0 = nil
|
3412
3574
|
end
|
3413
3575
|
|
@@ -3846,6 +4008,40 @@ module Less
|
|
3846
4008
|
r0
|
3847
4009
|
end
|
3848
4010
|
|
4011
|
+
def _nt_WS
|
4012
|
+
start_index = index
|
4013
|
+
if node_cache[:WS].has_key?(index)
|
4014
|
+
cached = node_cache[:WS][index]
|
4015
|
+
@index = cached.interval.end if cached
|
4016
|
+
return cached
|
4017
|
+
end
|
4018
|
+
|
4019
|
+
s0, i0 = [], index
|
4020
|
+
loop do
|
4021
|
+
if has_terminal?('[\\n ]', true, index)
|
4022
|
+
r1 = true
|
4023
|
+
@index += 1
|
4024
|
+
else
|
4025
|
+
r1 = nil
|
4026
|
+
end
|
4027
|
+
if r1
|
4028
|
+
s0 << r1
|
4029
|
+
else
|
4030
|
+
break
|
4031
|
+
end
|
4032
|
+
end
|
4033
|
+
if s0.empty?
|
4034
|
+
@index = i0
|
4035
|
+
r0 = nil
|
4036
|
+
else
|
4037
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
4038
|
+
end
|
4039
|
+
|
4040
|
+
node_cache[:WS][start_index] = r0
|
4041
|
+
|
4042
|
+
r0
|
4043
|
+
end
|
4044
|
+
|
3849
4045
|
module Ns0
|
3850
4046
|
end
|
3851
4047
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#yelow #short { color: #ffeeaa; }
|
2
|
+
#yelow #long { color: #ffeeaa; }
|
3
|
+
#yelow #rgba { color: rgba(255, 238, 170, 0.1); }
|
4
|
+
#blue #short { color: #0000ff; }
|
5
|
+
#blue #long { color: #0000ff; }
|
6
|
+
#blue #rgba { color: rgba(0, 0, 255, 0.1); }
|
7
|
+
#overflow .a { color: #000000; }
|
8
|
+
#overflow .b { color: #ffffff; }
|
9
|
+
#overflow .c { color: #ffffff; }
|
10
|
+
#overflow .d { color: #00ff00; }
|
data/spec/css/css-1.0.css
CHANGED
@@ -22,6 +22,8 @@ q:lang(no) { quotes: none; }
|
|
22
22
|
p + h1 { font-size: 2.2em; }
|
23
23
|
input[type="text"] { font-weight: normal; }
|
24
24
|
h2[title] { font-size: 100%; }
|
25
|
+
[disabled] { color: transparent; }
|
26
|
+
p:not([class*="lead"]) { color: black; }
|
25
27
|
#shorthands {
|
26
28
|
border: 1px solid #000000;
|
27
29
|
font: 12px/16px Arial;
|
data/spec/css/operations-1.0.css
CHANGED
data/spec/css/scope-1.0.css
CHANGED
data/spec/css/whitespace-1.0.css
CHANGED
data/spec/engine_spec.rb
CHANGED
@@ -54,6 +54,10 @@ describe Less::Engine do
|
|
54
54
|
lessify(:accessors).should == css(:accessors)
|
55
55
|
end
|
56
56
|
|
57
|
+
it "should parse colors in hex" do
|
58
|
+
lessify(:colors).should == css(:colors)
|
59
|
+
end
|
60
|
+
|
57
61
|
it "should parse mixins" do
|
58
62
|
lessify(:mixins).should == css(:mixins)
|
59
63
|
end
|
@@ -61,7 +65,7 @@ describe Less::Engine do
|
|
61
65
|
it "should handle custom functions" do
|
62
66
|
module Less::Functions
|
63
67
|
def color arg
|
64
|
-
Less::Node::Color.new("
|
68
|
+
Less::Node::Color.new("99", "99", "99") if arg == "evil red"
|
65
69
|
end
|
66
70
|
|
67
71
|
def increment a
|
data/spec/less/colors-1.0.less
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
#yelow {
|
2
|
+
#short {
|
3
|
+
color: #fea;
|
4
|
+
}
|
5
|
+
#long {
|
6
|
+
color: #ffeeaa;
|
7
|
+
}
|
8
|
+
#rgba {
|
9
|
+
color: rgba(255, 238, 170, 0.1);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
#blue {
|
14
|
+
#short {
|
15
|
+
color: #00f;
|
16
|
+
}
|
17
|
+
#long {
|
18
|
+
color: #0000ff;
|
19
|
+
}
|
20
|
+
#rgba {
|
21
|
+
color: rgba(0, 0, 255, 0.1);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
#overflow {
|
26
|
+
.a { color: #111111 - #444444; } // #000000
|
27
|
+
.b { color: #eee + #fff; } // #ffffff
|
28
|
+
.c { color: #aaa * 3; } // #ffffff
|
29
|
+
.d { color: #00ee00 + #009900; } // #00ff00
|
30
|
+
}
|
data/spec/less/css-1.0.less
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudhead-less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudhead
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-15 00:00:00 -07:00
|
13
13
|
default_executable: lessc
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- spec/command_spec.rb
|
137
137
|
- spec/css/accessors-1.0.css
|
138
138
|
- spec/css/big-1.0.css
|
139
|
+
- spec/css/colors-1.0.css
|
139
140
|
- spec/css/comments-1.0.css
|
140
141
|
- spec/css/css-1.0.css
|
141
142
|
- spec/css/functions-1.0.css
|