sass 3.2.0.alpha.59 → 3.2.0.alpha.60

Sign up to get free protection for your applications and to get access to all the features.
data/REVISION CHANGED
@@ -1 +1 @@
1
- 77d6cfe978e5d2d28ee6126e207e19b86b661c27
1
+ 3b7b3977a280d7117d185295abde521a6860f893
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.59
1
+ 3.2.0.alpha.60
@@ -224,7 +224,7 @@ module Sass
224
224
  # If you're compiling a single Sass file from the filesystem,
225
225
  # use \{Sass::Engine.for\_file}.
226
226
  # If you're compiling multiple files from the filesystem,
227
- # use {Sass::Plugin}.
227
+ # use {Sass::Plugin.
228
228
  #
229
229
  # @param template [String] The Sass template.
230
230
  # This template can be encoded using any encoding
@@ -51,20 +51,6 @@ module Sass::Media
51
51
  def to_src(options)
52
52
  queries.map {|q| q.to_src(options)}.join(', ')
53
53
  end
54
-
55
- # Returns a deep copy of this query list and all its children.
56
- #
57
- # @return [QueryList]
58
- def deep_copy
59
- QueryList.new(queries.map {|q| q.deep_copy})
60
- end
61
-
62
- # Sets the options hash for the script nodes in the media query.
63
- #
64
- # @param options [{Symbol => Object}] The options has to set.
65
- def options=(options)
66
- queries.each {|q| q.options = options}
67
- end
68
54
  end
69
55
 
70
56
  # A single media query.
@@ -178,25 +164,6 @@ module Sass::Media
178
164
  src << expressions.map {|e| e.to_src(options)}.join(' and ')
179
165
  src
180
166
  end
181
-
182
- # Returns a deep copy of this query and all its children.
183
- #
184
- # @return [Query]
185
- def deep_copy
186
- Query.new(
187
- modifier.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
188
- type.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
189
- expressions.map {|q| q.deep_copy})
190
- end
191
-
192
- # Sets the options hash for the script nodes in the media query.
193
- #
194
- # @param options [{Symbol => Object}] The options has to set.
195
- def options=(options)
196
- modifier.each {|m| m.options = options if m.is_a?(Sass::Script::Node)}
197
- type.each {|t| t.options = options if t.is_a?(Sass::Script::Node)}
198
- expressions.each {|e| e.options = options}
199
- end
200
167
  end
201
168
 
202
169
  # A media query expression.
@@ -265,23 +232,6 @@ module Sass::Media
265
232
  src << ')'
266
233
  src
267
234
  end
268
-
269
- # Returns a deep copy of this expression.
270
- #
271
- # @return [Expression]
272
- def deep_copy
273
- Expression.new(
274
- name.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
275
- value.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c})
276
- end
277
-
278
- # Sets the options hash for the script nodes in the expression.
279
- #
280
- # @param options [{Symbol => Object}] The options has to set.
281
- def options=(options)
282
- name.each {|n| n.options = options if n.is_a?(Sass::Script::Node)}
283
- value.each {|v| v.options = options if v.is_a?(Sass::Script::Node)}
284
- end
285
235
  end
286
236
 
287
237
  # Converts an interpolation array that may represent a single variable to source.
@@ -36,7 +36,7 @@ module Sass
36
36
  # @return [String] A string representation of the function call
37
37
  def inspect
38
38
  args = @args.map {|a| a.inspect}.join(', ')
39
- keywords = Sass::Util.hash_to_a(@keywords).
39
+ keywords = @keywords.sort_by {|k, v| k}.
40
40
  map {|k, v| "$#{k}: #{v.inspect}"}.join(', ')
41
41
  "#{name}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
42
42
  end
@@ -44,7 +44,7 @@ module Sass
44
44
  # @see Node#to_sass
45
45
  def to_sass(opts = {})
46
46
  args = @args.map {|a| a.to_sass(opts)}.join(', ')
47
- keywords = Sass::Util.hash_to_a(@keywords).
47
+ keywords = @keywords.sort_by {|k, v| k}.
48
48
  map {|k, v| "$#{dasherize(k, opts)}: #{v.to_sass(opts)}"}.join(', ')
49
49
  "#{dasherize(name, opts)}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
50
50
  end
@@ -55,6 +55,26 @@ The #options attribute is not set on this #{self.class}.
55
55
  MSG
56
56
  end
57
57
 
58
+ # The SassScript `and` operation.
59
+ #
60
+ # @param other [Literal] The right-hand side of the operator
61
+ # @return [Literal] The result of a logical and:
62
+ # `other` if this literal isn't a false {Bool},
63
+ # and this literal otherwise
64
+ def and(other)
65
+ to_bool ? other : self
66
+ end
67
+
68
+ # The SassScript `or` operation.
69
+ #
70
+ # @param other [Literal] The right-hand side of the operator
71
+ # @return [Literal] The result of the logical or:
72
+ # this literal if it isn't a false {Bool},
73
+ # and `other` otherwise
74
+ def or(other)
75
+ to_bool ? self : other
76
+ end
77
+
58
78
  # The SassScript `==` operation.
59
79
  # **Note that this returns a {Sass::Script::Bool} object,
60
80
  # not a Ruby boolean**.
@@ -72,14 +72,6 @@ module Sass::Script
72
72
  # @raise [Sass::SyntaxError] if the operation is undefined for the operands
73
73
  def _perform(environment)
74
74
  literal1 = @operand1.perform(environment)
75
-
76
- # Special-case :and and :or to support short-circuiting.
77
- if @operator == :and
78
- return literal1.to_bool ? @operand2.perform(environment) : literal1
79
- elsif @operator == :or
80
- return literal1.to_bool ? literal1 : @operand2.perform(environment)
81
- end
82
-
83
75
  literal2 = @operand2.perform(environment)
84
76
 
85
77
  begin
@@ -379,7 +379,7 @@ module Sass
379
379
  attr_reader :selector
380
380
 
381
381
  # @param [String] The name of the pseudoclass
382
- # @param [Selector::CommaSequence] The selector argument
382
+ # @param [Selector::Sequence] The selector argument
383
383
  def initialize(name, selector)
384
384
  @name = name
385
385
  @selector = selector
@@ -168,8 +168,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
168
168
  def visit_mixin(node)
169
169
  unless node.args.empty? && node.keywords.empty?
170
170
  args = node.args.map {|a| a.to_sass(@options)}.join(", ")
171
- keywords = Sass::Util.hash_to_a(node.keywords).
172
- map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
171
+ keywords = node.keywords.map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
173
172
  arglist = "(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
174
173
  end
175
174
  "#{tab_str}#{@format == :sass ? '+' : '@include '}#{dasherize(node.name)}#{arglist}#{node.has_children ? yield : semi}\n"
@@ -84,14 +84,4 @@ class Sass::Tree::Visitors::DeepCopy < Sass::Tree::Visitors::Base
84
84
  node.expr = node.expr.deep_copy
85
85
  yield
86
86
  end
87
-
88
- def visit_directive(node)
89
- node.value = node.value.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c}
90
- yield
91
- end
92
-
93
- def visit_media(node)
94
- node.query = query.deep_copy
95
- yield
96
- end
97
87
  end
@@ -247,8 +247,6 @@ END
247
247
  # Runs SassScript interpolation in the selector,
248
248
  # and then parses the result into a {Sass::Selector::CommaSequence}.
249
249
  def visit_rule(node)
250
- rule = node.rule
251
- rule = rule.map {|e| e.is_a?(String) && e != ' ' ? e.strip : e} if node.style == :compressed
252
250
  parser = Sass::SCSS::StaticParser.new(run_interp(node.rule), node.filename, node.line)
253
251
  node.parsed_rules ||= parser.parse_selector
254
252
  if node.options[:trace_selectors]
@@ -297,7 +295,6 @@ END
297
295
  end
298
296
 
299
297
  def visit_media(node)
300
- node.query = node.query.deep_copy
301
298
  node.query.perform {|interp| run_interp(interp)}
302
299
  yield
303
300
  end
@@ -94,14 +94,4 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
94
94
  node.expr.options = @options
95
95
  yield
96
96
  end
97
-
98
- def visit_directive(node)
99
- node.value.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
100
- yield
101
- end
102
-
103
- def visit_media(node)
104
- node.query.options = @options
105
- yield
106
- end
107
97
  end
@@ -67,10 +67,8 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
67
67
  end
68
68
 
69
69
  def visit_directive(node)
70
- was_in_directive = @in_directive
71
70
  return node.resolved_value + ";" unless node.has_children
72
71
  return node.resolved_value + " {}" if node.children.empty?
73
- @in_directive = @in_directive || !node.is_a?(Sass::Tree::MediaNode)
74
72
  result = if node.style == :compressed
75
73
  "#{node.resolved_value}{"
76
74
  else
@@ -103,8 +101,6 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
103
101
  else
104
102
  (node.style == :expanded ? "\n" : " ") + "}\n"
105
103
  end
106
- ensure
107
- @in_directive = was_in_directive
108
104
  end
109
105
 
110
106
  def visit_media(node)
@@ -137,11 +133,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
137
133
  joined_rules = node.resolved_rules.members.map do |seq|
138
134
  next if seq.has_placeholder?
139
135
  rule_part = seq.to_a.join
140
- if node.style == :compressed
141
- rule_part.gsub!(/([^,])\s*\n\s*/m, '\1 ')
142
- rule_part.gsub!(/\s*([,+>])\s*/m, '\1')
143
- rule_part.strip!
144
- end
136
+ rule_part.gsub!(/\s*([^,])\s*\n\s*/m, '\1 ') if node.style == :compressed
145
137
  rule_part
146
138
  end.compact.join(rule_separator)
147
139
 
@@ -153,7 +145,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
153
145
  old_spaces = ' ' * @tabs
154
146
  spaces = ' ' * (@tabs + 1)
155
147
  if node.style != :compressed
156
- if node.options[:debug_info] && !@in_directive
148
+ if node.options[:debug_info]
157
149
  to_return << visit(debug_info_rule(node.debug_info, node.options)) << "\n"
158
150
  elsif node.options[:trace_selectors]
159
151
  to_return << "#{old_spaces}/* "
@@ -199,7 +191,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
199
191
 
200
192
  def debug_info_rule(debug_info, options)
201
193
  node = Sass::Tree::DirectiveNode.resolved("@media -sass-debug-info")
202
- Sass::Util.hash_to_a(debug_info.map {|k, v| [k.to_s, v.to_s]}).each do |k, v|
194
+ debug_info.map {|k, v| [k.to_s, v.to_s]}.sort.each do |k, v|
203
195
  rule = Sass::Tree::RuleNode.new([""])
204
196
  rule.resolved_rules = Sass::Selector::CommaSequence.new(
205
197
  [Sass::Selector::Sequence.new(
@@ -218,20 +218,6 @@ module Sass
218
218
  lcs_backtrace(lcs_table(x, y, &block), x, y, x.size-1, y.size-1, &block)
219
219
  end
220
220
 
221
- # Converts a Hash to an Array. This is usually identical to `Hash#to_a`,
222
- # with the following exceptions:
223
- #
224
- # * In Ruby 1.8, `Hash#to_a` is not deterministically ordered, but this is.
225
- # * In Ruby 1.9 when running tests, this is ordered in the same way it would
226
- # be under Ruby 1.8 (sorted key order rather than insertion order).
227
- #
228
- # @param hash [Hash]
229
- # @return [Array]
230
- def hash_to_a(hash)
231
- return has.to_a unless ruby1_8? || defined?(Test::Unit)
232
- return hash.sort_by {|k, v| k}
233
- end
234
-
235
221
  # Returns information about the caller of the previous method.
236
222
  #
237
223
  # @param entry [String] An entry in the `#caller` list, or a similarly formatted string
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require File.dirname(__FILE__) + '/../test_helper'
4
- require File.dirname(__FILE__) + '/test_helper'
3
+ require 'test_helper'
4
+ require 'sass/test_helper'
5
5
  require 'sass/engine'
6
6
  require 'stringio'
7
7
  require 'mock_importer'
@@ -1028,23 +1028,6 @@ foo
1028
1028
  SASS
1029
1029
  end
1030
1030
 
1031
- def test_debug_info_in_keyframes
1032
- assert_equal(<<CSS, render(<<SASS, :debug_info => true))
1033
- @-webkit-keyframes warm {
1034
- from {
1035
- color: black; }
1036
-
1037
- to {
1038
- color: red; } }
1039
- CSS
1040
- @-webkit-keyframes warm
1041
- from
1042
- color: black
1043
- to
1044
- color: red
1045
- SASS
1046
- end
1047
-
1048
1031
  def test_empty_first_line
1049
1032
  assert_equal("#a {\n b: c; }\n", render("#a\n\n b: c"))
1050
1033
  end
@@ -2229,27 +2212,6 @@ SASS
2229
2212
 
2230
2213
  # Regression tests
2231
2214
 
2232
- def test_variable_in_media_in_mixin
2233
- assert_equal <<CSS, render(<<SASS)
2234
- @media screen and (min-width: 10px) {
2235
- body {
2236
- background: red; } }
2237
- @media screen and (min-width: 20px) {
2238
- body {
2239
- background: blue; } }
2240
- CSS
2241
- @mixin respond-to($width)
2242
- @media screen and (min-width: $width)
2243
- @content
2244
-
2245
- body
2246
- @include respond-to(10px)
2247
- background: red
2248
- @include respond-to(20px)
2249
- background: blue
2250
- SASS
2251
- end
2252
-
2253
2215
  def test_tricky_mixin_loop_exception
2254
2216
  render <<SASS
2255
2217
  @mixin foo($a)
@@ -2579,15 +2541,6 @@ CSS
2579
2541
  SASS
2580
2542
  end
2581
2543
 
2582
- def test_selector_compression
2583
- assert_equal <<CSS, render(<<SASS, :style => :compressed)
2584
- a>b,c+d,:-moz-any(e,f,g){h:i}
2585
- CSS
2586
- a > b, c + d, :-moz-any(e, f, g)
2587
- h: i
2588
- SASS
2589
- end
2590
-
2591
2544
  # Encodings
2592
2545
 
2593
2546
  unless Sass::Util.ruby1_8?
@@ -432,11 +432,6 @@ SASS
432
432
  assert_raise_message(Sass::SyntaxError, "wrong number of arguments (1 for 0) for `arg-error'") {resolve("arg-error(1)")}
433
433
  end
434
434
 
435
- def test_boolean_ops_short_circuit
436
- assert_equal "false", resolve("$ie and $ie <= 7", {}, env('ie' => Sass::Script::Bool.new(false)))
437
- assert_equal "true", resolve("$ie or $undef", {}, env('ie' => Sass::Script::Bool.new(true)))
438
- end
439
-
440
435
  # Regression Tests
441
436
 
442
437
  def test_funcall_has_higher_precedence_than_color_name
@@ -1245,11 +1245,11 @@ SCSS
1245
1245
 
1246
1246
 
1247
1247
  def test_newlines_removed_from_selectors_when_compressed
1248
- assert_equal <<CSS, render(<<SCSS, :style => :compressed)
1248
+ assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
1249
1249
  z a,z b{display:block}
1250
1250
  CSS
1251
- a
1252
- , b {
1251
+ a,
1252
+ b {
1253
1253
  z & {
1254
1254
  display: block;
1255
1255
  }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302955
4
+ hash: 592302949
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 59
12
- version: 3.2.0.alpha.59
11
+ - 60
12
+ version: 3.2.0.alpha.60
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-01-25 00:00:00 -05:00
22
+ date: 2012-01-19 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -86,7 +86,6 @@ files:
86
86
  - lib/sass/logger.rb
87
87
  - lib/sass/logger/base.rb
88
88
  - lib/sass/logger/log_level.rb
89
- - lib/sass/util.rb
90
89
  - lib/sass/plugin.rb
91
90
  - lib/sass/plugin/compiler.rb
92
91
  - lib/sass/plugin/configuration.rb
@@ -134,7 +133,7 @@ files:
134
133
  - lib/sass/shared.rb
135
134
  - lib/sass/tree/charset_node.rb
136
135
  - lib/sass/tree/comment_node.rb
137
- - lib/sass/tree/media_node.rb
136
+ - lib/sass/tree/node.rb
138
137
  - lib/sass/tree/debug_node.rb
139
138
  - lib/sass/tree/directive_node.rb
140
139
  - lib/sass/tree/each_node.rb
@@ -143,15 +142,14 @@ files:
143
142
  - lib/sass/tree/function_node.rb
144
143
  - lib/sass/tree/if_node.rb
145
144
  - lib/sass/tree/import_node.rb
145
+ - lib/sass/tree/media_node.rb
146
146
  - lib/sass/tree/mixin_def_node.rb
147
- - lib/sass/tree/node.rb
148
147
  - lib/sass/tree/mixin_node.rb
149
148
  - lib/sass/tree/prop_node.rb
150
149
  - lib/sass/tree/return_node.rb
151
150
  - lib/sass/tree/root_node.rb
152
151
  - lib/sass/tree/rule_node.rb
153
152
  - lib/sass/tree/content_node.rb
154
- - lib/sass/tree/trace_node.rb
155
153
  - lib/sass/tree/variable_node.rb
156
154
  - lib/sass/tree/visitors/base.rb
157
155
  - lib/sass/tree/visitors/check_nesting.rb
@@ -163,10 +161,12 @@ files:
163
161
  - lib/sass/tree/visitors/to_css.rb
164
162
  - lib/sass/tree/warn_node.rb
165
163
  - lib/sass/tree/while_node.rb
166
- - lib/sass/media.rb
164
+ - lib/sass/tree/trace_node.rb
165
+ - lib/sass/util.rb
167
166
  - lib/sass/util/multibyte_string_scanner.rb
168
167
  - lib/sass/util/subset_map.rb
169
168
  - lib/sass/version.rb
169
+ - lib/sass/media.rb
170
170
  - vendor/fssm/Gemfile
171
171
  - vendor/fssm/LICENSE
172
172
  - vendor/fssm/README.markdown