less 1.2.12 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.12
1
+ 1.2.13
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{less}
8
- s.version = "1.2.12"
8
+ s.version = "1.2.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["cloudhead"]
12
- s.date = %q{2009-11-18}
12
+ s.date = %q{2009-11-19}
13
13
  s.default_executable = %q{lessc}
14
14
  s.description = %q{LESS is leaner CSS}
15
15
  s.email = %q{self@cloudhead.net}
@@ -2,9 +2,9 @@ module Less
2
2
  grammar StyleSheet
3
3
  include Common
4
4
  include Entity
5
-
5
+
6
6
  rule primary
7
- (import / declaration / mixin / ruleset / comment)* {
7
+ (import / declaration / ruleset / mixin / comment)* {
8
8
  def build env = Less::Element.new
9
9
  elements.map do |e|
10
10
  e.build env if e.respond_to? :build
@@ -30,7 +30,7 @@ module Less
30
30
  end
31
31
  end
32
32
  # Mixin Declaration
33
- } / '.' name:[-a-zA-Z0-9_]+ ws parameters ws "{" ws primary ws "}" ws {
33
+ } / ws '.' name:[-a-zA-Z0-9_]+ ws parameters ws "{" ws primary ws "}" ws {
34
34
  def build env
35
35
  env << Node::Mixin::Def.new(name.text_value, parameters.build(env))
36
36
  primary.build env.last
@@ -64,7 +64,7 @@ module Less
64
64
  e.send(method, env) if e.respond_to? method
65
65
  end.compact
66
66
  end
67
-
67
+
68
68
  def all
69
69
  [selector] + tail.elements.map {|e| e.selector }
70
70
  end
@@ -82,7 +82,7 @@ module Less
82
82
  node.last
83
83
  end
84
84
  end
85
-
85
+
86
86
  def mixin env
87
87
  sel.elements.map do |e|
88
88
  Node::Element.new(e.element.text_value, e.select.text_value)
@@ -90,7 +90,7 @@ module Less
90
90
  end
91
91
  }
92
92
  end
93
-
93
+
94
94
  rule parameters
95
95
  '(' s ')' {
96
96
  def build env
@@ -102,7 +102,7 @@ module Less
102
102
  e.build(env)
103
103
  end
104
104
  end
105
-
105
+
106
106
  def all
107
107
  [parameter] + tail.elements.map {|e| e.parameter }
108
108
  end
@@ -116,7 +116,7 @@ module Less
116
116
  end
117
117
  }
118
118
  end
119
-
119
+
120
120
  rule import
121
121
  ws "@import" S url:(string / url) medias? s ';' ws {
122
122
  def build env
@@ -294,7 +294,7 @@ module Less
294
294
  end
295
295
  }
296
296
  end
297
-
297
+
298
298
  #
299
299
  # Functions and arguments
300
300
  #
@@ -313,7 +313,7 @@ module Less
313
313
  e.build if e.respond_to? :build
314
314
  end.compact
315
315
  end
316
-
316
+
317
317
  def all
318
318
  [expressions] + tail.elements.map {|e| e.expressions }
319
319
  end
@@ -324,4 +324,4 @@ module Less
324
324
  }
325
325
  end
326
326
  end
327
- end
327
+ end
@@ -13,7 +13,7 @@ module Less
13
13
  include Entity
14
14
 
15
15
  attr_accessor :rules, :selector, :file,
16
- :set, :imported, :name
16
+ :set, :imported, :name
17
17
 
18
18
  def initialize name = "", selector = ''
19
19
  @name = name
@@ -48,10 +48,11 @@ module Less
48
48
  # but it'll have to do until I find
49
49
  # a proper way to do it.
50
50
  def group
51
- matched = false
52
- stack, result = elements.dup, []
51
+ elements = self.elements.reject {|e| e.is_a?(Mixin::Def) }
53
52
  return self unless elements.size > 1
54
53
 
54
+ stack, result, matched = elements.dup, [], false
55
+
55
56
  elements.each do
56
57
  e = stack.first
57
58
  result << e unless matched
@@ -119,13 +120,13 @@ module Less
119
120
  self[element.name] if self[element.name].selector.class == selector.class
120
121
  end
121
122
  end
122
-
123
+
123
124
  def mix arr = []
124
125
  @rules += arr.map do |r|
125
126
  r.copy.tap {|i| i.parent = self }
126
127
  end
127
128
  end
128
-
129
+
129
130
  #
130
131
  # Add an arbitrary node to this element
131
132
  #
@@ -148,13 +149,15 @@ module Less
148
149
  def to_css path = [], env = nil
149
150
  path << @selector.to_css << name unless root?
150
151
 
151
- # puts "to_css env: #{env ? env.variables : "nil"}"
152
-
153
- content = (properties + mixins).map do |i|
152
+ # puts "to_css env: #{env ? env.variables : "nil"}"
153
+ content = @rules.select do |r|
154
+ r.is_a?(Mixin::Call) || r.instance_of?(Property)
155
+ end.map do |i|
154
156
  ' ' * 2 + i.to_css(env)
155
157
  end.compact.reject(&:empty?) * "\n"
156
158
 
157
159
  content = content.include?("\n") ? "\n#{content}\n" : " #{content.strip} "
160
+
158
161
  ruleset = if is_a?(Mixin::Def)
159
162
  content.strip
160
163
  else
@@ -163,12 +166,12 @@ module Less
163
166
  *@set.map(&:name)].uniq * ', '} {#{content}}\n" : ""
164
167
  end
165
168
 
166
- css = ruleset + elements.
167
- reject {|e| e.is_a? Mixin::Def }.map do |i|
169
+ ruleset + elements.reject {|e| e.is_a?(Mixin::Def) }.map do |i|
168
170
  i.to_css(path, env)
169
171
  end.reject(&:empty?).join
170
- 2.times {path.pop}
171
- css
172
+
173
+ ensure
174
+ 2.times { path.pop }
172
175
  end
173
176
 
174
177
  #
@@ -273,4 +276,4 @@ module Less
273
276
  end
274
277
  end
275
278
  end
276
- end
279
+ end
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.2.12
4
+ version: 1.2.13
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-11-18 00:00:00 -05:00
12
+ date: 2009-11-19 00:00:00 -05:00
13
13
  default_executable: lessc
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency