haml-edge 2.3.209 → 2.3.210

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/.yardopts +2 -0
  2. data/EDGE_GEM_VERSION +1 -1
  3. data/Rakefile +24 -2
  4. data/VERSION +1 -1
  5. data/lib/haml/exec.rb +11 -4
  6. data/lib/haml/filters.rb +3 -0
  7. data/lib/haml/helpers/action_view_extensions.rb +4 -2
  8. data/lib/haml/helpers/action_view_mods.rb +6 -4
  9. data/lib/haml/helpers.rb +2 -10
  10. data/lib/haml/html.rb +0 -1
  11. data/lib/haml/precompiler.rb +37 -30
  12. data/lib/haml/railtie.rb +6 -2
  13. data/lib/haml/root.rb +4 -0
  14. data/lib/haml/template.rb +2 -0
  15. data/lib/haml/util/subset_map.rb +101 -0
  16. data/lib/haml/util.rb +74 -0
  17. data/lib/haml.rb +5 -2
  18. data/lib/sass/engine.rb +36 -31
  19. data/lib/sass/files.rb +1 -1
  20. data/lib/sass/plugin/staleness_checker.rb +9 -9
  21. data/lib/sass/plugin.rb +21 -0
  22. data/lib/sass/script/color.rb +4 -3
  23. data/lib/sass/script/css_lexer.rb +11 -1
  24. data/lib/sass/script/css_parser.rb +4 -1
  25. data/lib/sass/script/funcall.rb +9 -0
  26. data/lib/sass/script/interpolation.rb +21 -0
  27. data/lib/sass/script/lexer.rb +30 -13
  28. data/lib/sass/script/node.rb +1 -1
  29. data/lib/sass/script/number.rb +4 -5
  30. data/lib/sass/script/parser.rb +13 -14
  31. data/lib/sass/script/string.rb +8 -2
  32. data/lib/sass/script/string_interpolation.rb +27 -4
  33. data/lib/sass/script.rb +1 -2
  34. data/lib/sass/scss/css_parser.rb +5 -3
  35. data/lib/sass/scss/parser.rb +146 -64
  36. data/lib/sass/scss/rx.rb +9 -1
  37. data/lib/sass/scss/sass_parser.rb +11 -0
  38. data/lib/sass/scss/script_lexer.rb +2 -0
  39. data/lib/sass/scss/static_parser.rb +48 -0
  40. data/lib/sass/scss.rb +3 -0
  41. data/lib/sass/selector/abstract_sequence.rb +40 -0
  42. data/lib/sass/selector/comma_sequence.rb +80 -0
  43. data/lib/sass/selector/sequence.rb +194 -0
  44. data/lib/sass/selector/simple.rb +107 -0
  45. data/lib/sass/selector/simple_sequence.rb +161 -0
  46. data/lib/sass/selector.rb +353 -0
  47. data/lib/sass/tree/comment_node.rb +1 -0
  48. data/lib/sass/tree/debug_node.rb +1 -0
  49. data/lib/sass/tree/directive_node.rb +1 -0
  50. data/lib/sass/tree/extend_node.rb +60 -0
  51. data/lib/sass/tree/for_node.rb +1 -0
  52. data/lib/sass/tree/if_node.rb +2 -0
  53. data/lib/sass/tree/import_node.rb +2 -0
  54. data/lib/sass/tree/mixin_def_node.rb +1 -0
  55. data/lib/sass/tree/mixin_node.rb +21 -5
  56. data/lib/sass/tree/node.rb +59 -12
  57. data/lib/sass/tree/prop_node.rb +20 -21
  58. data/lib/sass/tree/root_node.rb +8 -17
  59. data/lib/sass/tree/rule_node.rb +49 -100
  60. data/lib/sass/tree/variable_node.rb +1 -0
  61. data/lib/sass/tree/warn_node.rb +1 -0
  62. data/lib/sass/tree/while_node.rb +1 -0
  63. data/lib/sass.rb +1 -0
  64. data/test/haml/engine_test.rb +185 -3
  65. data/test/haml/helper_test.rb +25 -2
  66. data/test/haml/template_test.rb +2 -2
  67. data/test/haml/templates/helpers.haml +13 -0
  68. data/test/haml/util/subset_map_test.rb +91 -0
  69. data/test/haml/util_test.rb +25 -0
  70. data/test/sass/conversion_test.rb +23 -3
  71. data/test/sass/engine_test.rb +50 -7
  72. data/test/sass/extend_test.rb +1045 -0
  73. data/test/sass/results/complex.css +0 -1
  74. data/test/sass/results/script.css +1 -1
  75. data/test/sass/script_conversion_test.rb +16 -0
  76. data/test/sass/script_test.rb +37 -4
  77. data/test/sass/scss/css_test.rb +17 -3
  78. data/test/sass/scss/rx_test.rb +1 -1
  79. data/test/sass/scss/scss_test.rb +30 -0
  80. data/test/sass/templates/complex.sass +0 -2
  81. data/test/test_helper.rb +5 -0
  82. metadata +17 -3
@@ -17,7 +17,6 @@ body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-se
17
17
  #menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background: #00a4e4; }
18
18
  #menu .contests ul { margin: 0 5px 0 0; padding: 0; }
19
19
  #menu .contests ul li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: white; background: #00a4e4; }
20
- #menu .contests ul li / This rule isn't a comment! { red: green; }
21
20
  #menu .contests a:link, #menu .contests a:visited { color: white; text-decoration: none; font-weight: bold; }
22
21
  #menu .contests a:hover { text-decoration: underline; }
23
22
 
@@ -1,4 +1,4 @@
1
- #main { content: Hello\!; qstr: 'Quo"ted"!'; hstr: Hyph-en\!; width: 30em; background-color: black; color: #ffffaa; short-color: #112233; named-color: olive; con: "foo" bar(9 hi there "boom"); con2: "noquo" quo; }
1
+ #main { content: Hello\!; qstr: 'Quo"ted"!'; hstr: Hyph-en\!; width: 30em; background-color: black; color: #ffffaa; short-color: #112233; named-color: olive; con: "foo" bar 9 hi there "boom"; con2: "noquo" quo; }
2
2
  #main #sidebar { background-color: #00ff98; num-normal: 10; num-dec: 10.2; num-dec0: 99; num-neg: -10; esc: 10 \+12; many: 6; order: 7; complex: #4c9db1hi16; }
3
3
 
4
4
  #plus { num-num: 7; num-num-un: 25em; num-num-un2: 23em; num-num-neg: 9.87; num-str: 100px; num-col: #b7b7b7; num-perc: 31%; str-str: "hi\ there"; str-str2: "hi there"; str-col: "14em solid #112233"; str-num: "times: 13"; col-num: #ff7b9d; col-col: #5173ff; }
@@ -53,6 +53,12 @@ class SassScriptConversionTest < Test::Unit::TestCase
53
53
  assert_renders "-foo(12px)"
54
54
  end
55
55
 
56
+ def test_url
57
+ assert_renders "url(foo.gif)"
58
+ assert_renders "url($var)"
59
+ assert_renders "url(\#{$var}/flip.gif)"
60
+ end
61
+
56
62
  def test_variable
57
63
  assert_renders "$foo-bar"
58
64
  assert_renders "$flaznicate"
@@ -180,6 +186,16 @@ RUBY
180
186
  assert_equal "unquote(\"f'o\#{$bar}b\\\"z\")", render("'f\\'o\#{$bar}b\\\"z'", :context => :equals)
181
187
  end
182
188
 
189
+ def test_sass2_urls
190
+ Haml::Util.silence_haml_warnings do
191
+ assert_equal 'url(foo/bar.gif)', render('url(foo/bar.gif)', :context => :equals)
192
+ assert_equal 'url("foo/bar.gif")', render('url("foo/bar.gif")', :context => :equals)
193
+
194
+ assert_equal 'url($var)', render('url(!var)', :context => :equals)
195
+ assert_equal 'url("#{$var}/flip.gif")', render('url("#{!var}/flip.gif")', :context => :equals)
196
+ end
197
+ end
198
+
183
199
  private
184
200
 
185
201
  def assert_renders(script, options = {})
@@ -113,17 +113,17 @@ foo \#{"\#{"ba" + "r"} baz"} bang
113
113
  a: b
114
114
  SASS
115
115
  assert_equal(<<CSS, render(<<SASS))
116
- foo \#{bar baz} bang {
116
+ foo [bar="\#{bar baz}"] bang {
117
117
  a: b; }
118
118
  CSS
119
- foo \\\#{\#{"ba" + "r"} baz} bang
119
+ foo [bar="\\\#{\#{"ba" + "r"} baz}"] bang
120
120
  a: b
121
121
  SASS
122
122
  assert_equal(<<CSS, render(<<SASS))
123
- foo \#{baz bang {
123
+ foo [bar="\#{baz"] bang {
124
124
  a: b; }
125
125
  CSS
126
- foo \#{"\\\#{" + "baz"} bang
126
+ foo [bar="\#{"\\\#{" + "baz"}"] bang
127
127
  a: b
128
128
  SASS
129
129
  end
@@ -143,6 +143,25 @@ SASS
143
143
  assert_equal "Options defined!", resolve("assert_options(round(1.2))")
144
144
  end
145
145
 
146
+ def test_funcall_requires_no_whitespace_before_lparen
147
+ assert_equal "no-repeat 15px", resolve("no-repeat (7px + 8px)")
148
+ assert_equal "no-repeat(15px)", resolve("no-repeat(7px + 8px)")
149
+ end
150
+
151
+ def test_dynamic_url
152
+ assert_equal "url(foo-bar)", resolve("url($foo)", {}, env('foo' => Sass::Script::String.new("foo-bar")))
153
+ assert_equal "url(foo-bar baz)", resolve("url($foo $bar)", {}, env('foo' => Sass::Script::String.new("foo-bar"), 'bar' => Sass::Script::String.new("baz")))
154
+ assert_equal "url(foo baz)", resolve("url(foo $bar)", {}, env('bar' => Sass::Script::String.new("baz")))
155
+ assert_equal "url(foo bar)", resolve("url(foo bar)")
156
+ end
157
+
158
+ def test_url_with_interpolation
159
+ assert_equal "url(http://sass-lang.com/images/foo-bar)", resolve("url(http://sass-lang.com/images/\#{foo-bar})")
160
+ assert_equal 'url("http://sass-lang.com/images/foo-bar")', resolve("url('http://sass-lang.com/images/\#{foo-bar}')")
161
+ assert_equal 'url("http://sass-lang.com/images/foo-bar")', resolve('url("http://sass-lang.com/images/#{foo-bar}")')
162
+ assert_unquoted "url(http://sass-lang.com/images/\#{foo-bar})"
163
+ end
164
+
146
165
  def test_hyphenated_variables
147
166
  assert_equal("a-b", resolve("$a-b", {}, env("a-b" => Sass::Script::String.new("a-b"))))
148
167
  end
@@ -305,6 +324,20 @@ SASS
305
324
  val.is_a?(Sass::Script::String) ? val.value : val.to_s
306
325
  end
307
326
 
327
+ def assert_unquoted(str, opts = {}, environment = env)
328
+ munge_filename opts
329
+ val = eval(str, opts, environment)
330
+ assert_kind_of Sass::Script::String, val
331
+ assert_equal :identifier, val.type
332
+ end
333
+
334
+ def assert_quoted(str, opts = {}, environment = env)
335
+ munge_filename opts
336
+ val = eval(str, opts, environment)
337
+ assert_kind_of Sass::Script::String, val
338
+ assert_equal :string, val.type
339
+ end
340
+
308
341
  def eval(str, opts = {}, environment = env)
309
342
  munge_filename opts
310
343
  Sass::Script.parse(str, opts.delete(:line) || 1,
@@ -157,7 +157,7 @@ SCSS
157
157
 
158
158
  def test_selector_comments
159
159
  assert_equal <<CSS, render(<<SCSS)
160
- .foo #bar:baz( bip) {
160
+ .foo #bar:baz(bip) {
161
161
  a: b; }
162
162
  CSS
163
163
  .foo /* .a #foo */ #bar:baz(/* bang )*/ bip) {
@@ -675,7 +675,14 @@ SCSS
675
675
  assert_selector_parses(':nth-child(+2n-3)')
676
676
  assert_selector_parses(':nth-child(-2n+3)')
677
677
  assert_selector_parses(':nth-child(-2n+ 3)')
678
- assert_selector_parses(':nth-child( 2n + 3 )')
678
+
679
+ assert_equal(<<CSS, render(<<SCSS))
680
+ :nth-child(2n + 3) {
681
+ a: b; }
682
+ CSS
683
+ :nth-child( 2n + 3 ) {
684
+ a: b; }
685
+ SCSS
679
686
  end
680
687
 
681
688
  def test_negation_selectors
@@ -743,7 +750,14 @@ SCSS
743
750
  assert_selector_parses('> E')
744
751
  assert_selector_parses('+ E')
745
752
  assert_selector_parses('~ E')
746
- assert_selector_parses('>> E')
753
+ assert_selector_parses('> > E')
754
+ assert_equal <<CSS, render(<<SCSS)
755
+ > > E {
756
+ a: b; }
757
+ CSS
758
+ >> E {
759
+ a: b; }
760
+ SCSS
747
761
 
748
762
  assert_selector_parses('E*')
749
763
  assert_selector_parses('E*.foo')
@@ -93,7 +93,7 @@ class ScssRxTest < Test::Unit::TestCase
93
93
  assert_match URI, 'url("foo bar)")'
94
94
  assert_match URI, "url('foo bar)')"
95
95
  assert_match URI, 'url( "foo bar)" )'
96
- assert_match URI, "url(!#\$%&**+,-./0123456789~)"
96
+ assert_match URI, "url(#\\%&**+,-./0123456789~)"
97
97
  end
98
98
 
99
99
  def test_invalid_uri
@@ -940,4 +940,34 @@ SCSS
940
940
  assert_equal "Undefined variable: \"$bang\".", e.message
941
941
  assert_equal 4, e.sass_line
942
942
  end
943
+
944
+ def test_post_resolution_selector_error
945
+ assert_raise(Sass::SyntaxError, 'Invalid CSS after "foo ": expected selector, was ") bar"') do
946
+ render 'foo #{") bar"} {a: b}'
947
+ end
948
+ end
949
+
950
+ def test_parent_in_mid_selector_error
951
+ assert_raise(Sass::SyntaxError, 'Invalid CSS after ".foo": expected "{", was "&.bar"') {render <<SCSS}
952
+ flim {
953
+ .foo&.bar {a: b}
954
+ }
955
+ SCSS
956
+ end
957
+
958
+ def test_parent_in_mid_selector_error
959
+ assert_raise(Sass::SyntaxError, 'Invalid CSS after ".foo.bar": expected "{", was "&"') {render <<SCSS}
960
+ flim {
961
+ .foo.bar& {a: b}
962
+ }
963
+ SCSS
964
+ end
965
+
966
+ def test_double_parent_selector_error
967
+ assert_raise(Sass::SyntaxError, 'Invalid CSS after "&": expected "{", was "&"') {render <<SCSS}
968
+ flim {
969
+ && {a: b}
970
+ }
971
+ SCSS
972
+ end
943
973
  end
@@ -83,8 +83,6 @@ body
83
83
  // This comment is properly indented
84
84
  :color #fff
85
85
  :background #00a4e4
86
- / This rule isn't a comment!
87
- :red green
88
86
  a:link, a:visited
89
87
  :color #fff
90
88
  :text-decoration none
data/test/test_helper.rb CHANGED
@@ -59,4 +59,9 @@ class Test::Unit::TestCase
59
59
  return '=' if Haml::Util.ap_geq_3?
60
60
  return '-'
61
61
  end
62
+
63
+ def form_for_calling_convention(name)
64
+ return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3_beta_3?
65
+ return ":#{name}, @#{name}"
66
+ end
62
67
  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: 2.3.209
4
+ version: 2.3.210
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-04-14 00:00:00 -04:00
13
+ date: 2010-04-26 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -65,15 +65,16 @@ files:
65
65
  - lib/haml/helpers/xss_mods.rb
66
66
  - lib/haml/html.rb
67
67
  - lib/haml/precompiler.rb
68
- - lib/haml/html/erb.rb
69
68
  - lib/haml/railtie.rb
70
69
  - lib/haml/util.rb
70
+ - lib/haml/html/erb.rb
71
71
  - lib/haml/shared.rb
72
72
  - lib/haml/template.rb
73
73
  - lib/haml/template/patch.rb
74
74
  - lib/haml/template/plugin.rb
75
75
  - lib/haml/version.rb
76
76
  - lib/haml/root.rb
77
+ - lib/haml/util/subset_map.rb
77
78
  - lib/sass.rb
78
79
  - lib/sass/css.rb
79
80
  - lib/sass/engine.rb
@@ -121,11 +122,20 @@ files:
121
122
  - lib/sass/tree/while_node.rb
122
123
  - lib/sass/tree/root_node.rb
123
124
  - lib/sass/tree/warn_node.rb
125
+ - lib/sass/tree/extend_node.rb
124
126
  - lib/sass/scss/css_parser.rb
125
127
  - lib/sass/scss/parser.rb
126
128
  - lib/sass/scss/rx.rb
127
129
  - lib/sass/scss/script_lexer.rb
128
130
  - lib/sass/scss/script_parser.rb
131
+ - lib/sass/scss/sass_parser.rb
132
+ - lib/sass/scss/static_parser.rb
133
+ - lib/sass/selector.rb
134
+ - lib/sass/selector/abstract_sequence.rb
135
+ - lib/sass/selector/comma_sequence.rb
136
+ - lib/sass/selector/sequence.rb
137
+ - lib/sass/selector/simple.rb
138
+ - lib/sass/selector/simple_sequence.rb
129
139
  - vendor/fssm/LICENSE
130
140
  - vendor/fssm/README.markdown
131
141
  - vendor/fssm/Rakefile
@@ -228,6 +238,7 @@ files:
228
238
  - test/haml/templates/very_basic.haml
229
239
  - test/haml/templates/whitespace_handling.haml
230
240
  - test/haml/spec_test.rb
241
+ - test/haml/util/subset_map_test.rb
231
242
  - test/linked_rails.rb
232
243
  - test/sass/css2sass_test.rb
233
244
  - test/sass/engine_test.rb
@@ -303,6 +314,7 @@ files:
303
314
  - test/sass/templates/warn.sass
304
315
  - test/sass/templates/warn_imported.sass
305
316
  - test/sass/script_conversion_test.rb
317
+ - test/sass/extend_test.rb
306
318
  - test/test_helper.rb
307
319
  - extra/haml-mode.el
308
320
  - extra/sass-mode.el
@@ -360,6 +372,7 @@ test_files:
360
372
  - test/haml/template_test.rb
361
373
  - test/haml/util_test.rb
362
374
  - test/haml/spec_test.rb
375
+ - test/haml/util/subset_map_test.rb
363
376
  - test/sass/css2sass_test.rb
364
377
  - test/sass/engine_test.rb
365
378
  - test/sass/functions_test.rb
@@ -371,3 +384,4 @@ test_files:
371
384
  - test/sass/callbacks_test.rb
372
385
  - test/sass/conversion_test.rb
373
386
  - test/sass/script_conversion_test.rb
387
+ - test/sass/extend_test.rb