less 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/less.gemspec +4 -2
- data/lib/less.rb +3 -3
- data/lib/less/engine/nodes/literal.rb +17 -25
- data/lib/less/engine/nodes/property.rb +1 -1
- data/spec/css/css3-1.0.css +3 -0
- data/spec/less/css3-1.0.less +11 -0
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.11
|
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.11"
|
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-17}
|
10
10
|
s.default_executable = %q{lessc}
|
11
11
|
s.description = %q{LESS is leaner CSS}
|
12
12
|
s.email = %q{self@cloudhead.net}
|
@@ -132,6 +132,7 @@ Gem::Specification.new do |s|
|
|
132
132
|
"spec/css/colors-1.0.css",
|
133
133
|
"spec/css/comments-1.0.css",
|
134
134
|
"spec/css/css-1.0.css",
|
135
|
+
"spec/css/css3-1.0.css",
|
135
136
|
"spec/css/functions-1.0.css",
|
136
137
|
"spec/css/import-1.0.css",
|
137
138
|
"spec/css/mixins-1.0.css",
|
@@ -147,6 +148,7 @@ Gem::Specification.new do |s|
|
|
147
148
|
"spec/less/colors-1.0.less",
|
148
149
|
"spec/less/comments-1.0.less",
|
149
150
|
"spec/less/css-1.0.less",
|
151
|
+
"spec/less/css3-1.0.less",
|
150
152
|
"spec/less/exceptions/mixed-units-error.less",
|
151
153
|
"spec/less/exceptions/name-error-1.0.less",
|
152
154
|
"spec/less/exceptions/syntax-error-1.0.less",
|
data/lib/less.rb
CHANGED
@@ -13,12 +13,12 @@ require 'less/command'
|
|
13
13
|
require 'less/engine'
|
14
14
|
|
15
15
|
module Less
|
16
|
-
MixedUnitsError = Class.new(
|
17
|
-
PathError = Class.new(
|
16
|
+
MixedUnitsError = Class.new(RuntimeError)
|
17
|
+
PathError = Class.new(RuntimeError)
|
18
18
|
VariableNameError = Class.new(NameError)
|
19
19
|
MixinNameError = Class.new(NameError)
|
20
20
|
SyntaxError = Class.new(RuntimeError)
|
21
|
-
ImportError = Class.new(
|
21
|
+
ImportError = Class.new(RuntimeError)
|
22
22
|
|
23
23
|
$verbose = false
|
24
24
|
|
@@ -15,13 +15,15 @@ module Less
|
|
15
15
|
include Literal
|
16
16
|
attr_reader :r, :g, :b, :a
|
17
17
|
|
18
|
-
def initialize
|
19
|
-
r, g, b = [r, g, b].map
|
20
|
-
|
18
|
+
def initialize r, g, b, a = 1.0
|
19
|
+
@r, @g, @b = [r, g, b].map do |c|
|
20
|
+
normalize(c.is_a?(::String) ? c.to_i(16) : c)
|
21
|
+
end
|
22
|
+
@a = normalize(a, 1.0)
|
21
23
|
end
|
22
24
|
|
23
|
-
def alpha
|
24
|
-
self.class.new
|
25
|
+
def alpha v
|
26
|
+
self.class.new r, g, b, v
|
25
27
|
end
|
26
28
|
|
27
29
|
def rgb
|
@@ -29,28 +31,18 @@ module Less
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def operate op, other
|
32
|
-
if other.is_a? Numeric
|
33
|
-
|
34
|
+
color = if other.is_a? Numeric
|
35
|
+
rgb.map {|c| c.send(op, other) }
|
34
36
|
else
|
35
|
-
|
37
|
+
rgb.zip(other.rgb).map {|a, b| a.send(op, b) }
|
36
38
|
end
|
39
|
+
self.class.new *[color, @a].flatten # Ruby 1.8 hack
|
37
40
|
end
|
38
41
|
|
39
|
-
def + other
|
40
|
-
|
41
|
-
end
|
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
|
42
|
+
def + other; operate :+, other end
|
43
|
+
def - other; operate :-, other end
|
44
|
+
def * other; operate :*, other end
|
45
|
+
def / other; operate :/, other end
|
54
46
|
|
55
47
|
def coerce other
|
56
48
|
return self, other
|
@@ -60,7 +52,7 @@ module Less
|
|
60
52
|
if a < 1.0
|
61
53
|
"rgba(#{r.to_i}, #{g.to_i}, #{b.to_i}, #{a})"
|
62
54
|
else
|
63
|
-
"#%02x%02x%02x" % [r,g,b]
|
55
|
+
"#%02x%02x%02x" % [r, g, b]
|
64
56
|
end
|
65
57
|
end
|
66
58
|
|
@@ -77,7 +69,7 @@ module Less
|
|
77
69
|
end
|
78
70
|
|
79
71
|
def to_ruby
|
80
|
-
"
|
72
|
+
"#{self.class}.new(#{r},#{g},#{b},#{a})"
|
81
73
|
end
|
82
74
|
|
83
75
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
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-17 00:00:00 -04:00
|
13
13
|
default_executable: lessc
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- spec/css/colors-1.0.css
|
140
140
|
- spec/css/comments-1.0.css
|
141
141
|
- spec/css/css-1.0.css
|
142
|
+
- spec/css/css3-1.0.css
|
142
143
|
- spec/css/functions-1.0.css
|
143
144
|
- spec/css/import-1.0.css
|
144
145
|
- spec/css/mixins-1.0.css
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- spec/less/colors-1.0.less
|
155
156
|
- spec/less/comments-1.0.less
|
156
157
|
- spec/less/css-1.0.less
|
158
|
+
- spec/less/css3-1.0.less
|
157
159
|
- spec/less/exceptions/mixed-units-error.less
|
158
160
|
- spec/less/exceptions/name-error-1.0.less
|
159
161
|
- spec/less/exceptions/syntax-error-1.0.less
|