haml-edge 3.1.76 → 3.1.77

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 3.1.76
1
+ 3.1.77
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.76
1
+ 3.1.77
@@ -73,7 +73,7 @@ a specific level to which the current line could be indented.")
73
73
  `(,(concat haml-tag-beg-re "[><]*[ \t]*$")
74
74
  "^[ \t]*[&!]?[-=~].*do[ \t]*\\(|.*|[ \t]*\\)?$"
75
75
  ,(concat "^[ \t]*[&!]?[-=~][ \t]*\\("
76
- (regexp-opt '("if" "unless" "while" "until" "else"
76
+ (regexp-opt '("if" "unless" "while" "until" "else" "for"
77
77
  "begin" "elsif" "rescue" "ensure" "when"))
78
78
  "\\)")
79
79
  "^[ \t]*/\\(\\[.*\\]\\)?[ \t]*$"
@@ -280,7 +280,7 @@ END
280
280
  input = @options[:input]
281
281
  output = @options[:output]
282
282
 
283
- @options[:syntax] ||= :scss if input.is_a?(File) && input.path =~ /\.scss$/
283
+ @options[:for_engine][:syntax] ||= :scss if input.is_a?(File) && input.path =~ /\.scss$/
284
284
  engine =
285
285
  if input.is_a?(File) && !@options[:check_syntax]
286
286
  ::Sass::Engine.for_file(input.path, @options[:for_engine])
@@ -66,6 +66,9 @@ module Sass::Script
66
66
  # \{#complement}
67
67
  # : Returns the complement of a color.
68
68
  #
69
+ # \{#invert}
70
+ # : Returns the inverse of a color.
71
+ #
69
72
  # ## Opacity Functions
70
73
  #
71
74
  # \{#alpha} / \{#opacity}
@@ -655,6 +658,20 @@ module Sass::Script
655
658
  adjust_hue color, Number.new(180)
656
659
  end
657
660
 
661
+ # Returns the inverse (negative) of a color.
662
+ # The red, green, and blue values are inverted, while the opacity is left alone.
663
+ #
664
+ # @param color [Color]
665
+ # @return [Color]
666
+ # @raise [ArgumentError] if `color` isn't a color
667
+ def invert(color)
668
+ assert_type color, :Color
669
+ color.with(
670
+ :red => (255 - color.red),
671
+ :green => (255 - color.green),
672
+ :blue => (255 - color.blue))
673
+ end
674
+
658
675
  # Removes quotes from a string if the string is quoted,
659
676
  # or returns the same string if it's not.
660
677
  #
@@ -246,7 +246,7 @@ RUBY
246
246
  return if @stop_at && @stop_at.include?(@lexer.peek.value)
247
247
 
248
248
  name = @lexer.next
249
- if color = Color::HTML4_COLORS[name.value]
249
+ if color = Color::HTML4_COLORS[name.value.downcase]
250
250
  return node(Color.new(color))
251
251
  end
252
252
  node(Script::String.new(name.value, :identifier))
@@ -134,7 +134,7 @@ module Sass::Tree
134
134
  per_rule_indent, total_indent = [:nested, :expanded].include?(style) ? [rule_indent, ''] : ['', rule_indent]
135
135
 
136
136
  total_rule = total_indent + resolved_rules.members.
137
- map {|seq| seq.to_a.join}.
137
+ map {|seq| seq.to_a.join.gsub("\n", style == :compressed ? " " : "\n")}.
138
138
  join(rule_separator).split("\n").map do |line|
139
139
  per_rule_indent + line.strip
140
140
  end.join(line_separator)
@@ -469,6 +469,15 @@ class SassFunctionTest < Test::Unit::TestCase
469
469
  assert_error_message("\"foo\" is not a color for `complement'", "complement(\"foo\")")
470
470
  end
471
471
 
472
+ def test_invert
473
+ assert_equal("#112233", evaluate("invert(#edc)"))
474
+ assert_equal("rgba(245, 235, 225, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5))"))
475
+ end
476
+
477
+ def test_invert_tests_types
478
+ assert_error_message("\"foo\" is not a color for `invert'", "invert(\"foo\")")
479
+ end
480
+
472
481
  def test_unquote
473
482
  assert_equal('foo', evaluate('unquote("foo")'))
474
483
  assert_equal('foo', evaluate('unquote(foo)'))
@@ -372,6 +372,12 @@ SASS
372
372
  "Colors must have either three or six digits: '#abcdEFA'") {eval("#abcdEFA")}
373
373
  end
374
374
 
375
+ def test_case_insensitive_color_names
376
+ assert_equal "blue", resolve("BLUE")
377
+ assert_equal "red", resolve("rEd")
378
+ assert_equal "#7f4000", resolve("mix(GrEeN, ReD)")
379
+ end
380
+
375
381
  # Regression Tests
376
382
 
377
383
  def test_funcall_has_higher_precedence_than_color_name
@@ -1071,4 +1071,18 @@ $bar : "#foo";
1071
1071
  ul li\#{$bar} a span.label { foo: bar; }
1072
1072
  SCSS
1073
1073
  end
1074
+
1075
+ def test_newlines_removed_from_selectors_when_compressed
1076
+ assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
1077
+ z a,z b{display:block}
1078
+ CSS
1079
+ a,
1080
+ b {
1081
+ z & {
1082
+ display: block;
1083
+ }
1084
+ }
1085
+ SCSS
1086
+
1087
+ end
1074
1088
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.76
4
+ version: 3.1.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-09-13 00:00:00 -04:00
14
+ date: 2010-09-22 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -73,17 +73,20 @@ files:
73
73
  - lib/haml/version.rb
74
74
  - lib/sass.rb
75
75
  - lib/sass/callbacks.rb
76
- - lib/sass/css.rb
77
76
  - lib/sass/engine.rb
78
- - lib/sass/environment.rb
77
+ - lib/sass/css.rb
79
78
  - lib/sass/error.rb
80
- - lib/sass/less.rb
79
+ - lib/sass/environment.rb
81
80
  - lib/sass/plugin.rb
81
+ - lib/sass/importers.rb
82
+ - lib/sass/less.rb
83
+ - lib/sass/importers/base.rb
84
+ - lib/sass/importers/filesystem.rb
82
85
  - lib/sass/plugin/configuration.rb
83
- - lib/sass/plugin/generic.rb
84
86
  - lib/sass/plugin/merb.rb
85
- - lib/sass/plugin/rack.rb
87
+ - lib/sass/plugin/generic.rb
86
88
  - lib/sass/plugin/rails.rb
89
+ - lib/sass/plugin/rack.rb
87
90
  - lib/sass/plugin/staleness_checker.rb
88
91
  - lib/sass/plugin/compiler.rb
89
92
  - lib/sass/repl.rb
@@ -136,9 +139,6 @@ files:
136
139
  - lib/sass/tree/warn_node.rb
137
140
  - lib/sass/tree/while_node.rb
138
141
  - lib/sass/cache_store.rb
139
- - lib/sass/importers.rb
140
- - lib/sass/importers/base.rb
141
- - lib/sass/importers/filesystem.rb
142
142
  - vendor/fssm/LICENSE
143
143
  - vendor/fssm/README.markdown
144
144
  - vendor/fssm/Rakefile
@@ -243,13 +243,15 @@ files:
243
243
  - test/haml/util/subset_map_test.rb
244
244
  - test/haml/util_test.rb
245
245
  - test/linked_rails.rb
246
+ - test/sass/engine_test.rb
246
247
  - test/sass/callbacks_test.rb
247
248
  - test/sass/conversion_test.rb
248
249
  - test/sass/css2sass_test.rb
249
250
  - test/sass/data/hsl-rgb.txt
250
- - test/sass/engine_test.rb
251
+ - test/sass/plugin_test.rb
251
252
  - test/sass/extend_test.rb
252
253
  - test/sass/functions_test.rb
254
+ - test/sass/cache_test.rb
253
255
  - test/sass/less_conversion_test.rb
254
256
  - test/sass/more_results/more1.css
255
257
  - test/sass/more_results/more1_with_line_comments.css
@@ -257,7 +259,7 @@ files:
257
259
  - test/sass/more_templates/_more_partial.sass
258
260
  - test/sass/more_templates/more1.sass
259
261
  - test/sass/more_templates/more_import.sass
260
- - test/sass/plugin_test.rb
262
+ - test/sass/importer_test.rb
261
263
  - test/sass/results/alt.css
262
264
  - test/sass/results/basic.css
263
265
  - test/sass/results/compact.css
@@ -320,8 +322,6 @@ files:
320
322
  - test/sass/templates/units.sass
321
323
  - test/sass/templates/warn.sass
322
324
  - test/sass/templates/warn_imported.sass
323
- - test/sass/cache_test.rb
324
- - test/sass/importer_test.rb
325
325
  - test/sass/test_helper.rb
326
326
  - test/test_helper.rb
327
327
  - extra/haml-mode.el
@@ -374,18 +374,18 @@ test_files:
374
374
  - test/haml/template_test.rb
375
375
  - test/haml/util/subset_map_test.rb
376
376
  - test/haml/util_test.rb
377
+ - test/sass/engine_test.rb
377
378
  - test/sass/callbacks_test.rb
378
379
  - test/sass/conversion_test.rb
379
380
  - test/sass/css2sass_test.rb
380
- - test/sass/engine_test.rb
381
+ - test/sass/plugin_test.rb
381
382
  - test/sass/extend_test.rb
382
383
  - test/sass/functions_test.rb
384
+ - test/sass/cache_test.rb
383
385
  - test/sass/less_conversion_test.rb
384
- - test/sass/plugin_test.rb
386
+ - test/sass/importer_test.rb
385
387
  - test/sass/script_conversion_test.rb
386
388
  - test/sass/script_test.rb
387
389
  - test/sass/scss/css_test.rb
388
390
  - test/sass/scss/rx_test.rb
389
391
  - test/sass/scss/scss_test.rb
390
- - test/sass/cache_test.rb
391
- - test/sass/importer_test.rb