haml 3.0.0.beta.2 → 3.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0.beta.2
1
+ 3.0.0.beta.3
@@ -234,7 +234,7 @@ module Sass
234
234
  end
235
235
 
236
236
  comment_tab_str ||= line_tab_str
237
- if try_comment(line, lines.last, tab_str * (lines.last.tabs + 1), comment_tab_str, index)
237
+ if try_comment(line, lines.last, tab_str * lines.last.tabs, comment_tab_str, index)
238
238
  next
239
239
  else
240
240
  comment_tab_str = nil
@@ -256,7 +256,9 @@ END
256
256
 
257
257
  def try_comment(line, last, tab_str, comment_tab_str, index)
258
258
  return unless last && last.comment?
259
- return unless line =~ /^#{tab_str}/
259
+ # Nested comment stuff must be at least one whitespace char deeper
260
+ # than the normal indentation
261
+ return unless line =~ /^#{tab_str}\s/
260
262
  unless line =~ /^(?:#{comment_tab_str})(.*)$/
261
263
  raise SyntaxError.new(<<MSG.strip.gsub("\n", " "), :line => index)
262
264
  Inconsistent indentation:
@@ -467,9 +469,13 @@ WARNING
467
469
 
468
470
  # If value begins with url( or ",
469
471
  # it's a CSS @import rule and we don't want to touch it.
470
- if directive == "import" && value !~ /^(url\(|["'])/
472
+ if directive == "import"
471
473
  raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.",
472
474
  :line => @line + 1) unless line.children.empty?
475
+ if (match = value.match(Sass::SCSS::RX::STRING) || value.match(Sass::SCSS::RX::URI)) &&
476
+ !match.post_match.strip.empty? && match.post_match.strip[0] != ?,
477
+ return Tree::DirectiveNode.new("@import #{value}")
478
+ end
473
479
  value.split(/,\s*/).map do |f|
474
480
  f = $1 || $2 || $3 if f =~ Sass::SCSS::RX::STRING || f =~ Sass::SCSS::RX::URI
475
481
  Tree::ImportNode.new(f)
@@ -67,8 +67,8 @@ module Sass::Tree
67
67
  end
68
68
  end
69
69
 
70
- content.gsub!(/^/, ' ' * tabs)
71
70
  content.gsub!(/\A\/\*/, '//') if silent
71
+ content.gsub!(/^/, ' ' * tabs)
72
72
  content.rstrip + "\n"
73
73
  end
74
74
 
@@ -286,6 +286,50 @@ foo bar
286
286
  SASS
287
287
  end
288
288
 
289
+ def test_nested_silent_comments
290
+ assert_renders <<SASS, <<SCSS
291
+ foo
292
+ bar: baz
293
+ // bip bop
294
+ // beep boop
295
+ bang: bizz
296
+ // bubble bubble
297
+ // toil trouble
298
+ SASS
299
+ foo {
300
+ bar: baz;
301
+ // bip bop
302
+ // beep boop
303
+ bang: bizz;
304
+ // bubble bubble
305
+ // toil trouble
306
+ }
307
+ SCSS
308
+
309
+ assert_sass_to_scss <<SCSS, <<SASS
310
+ foo {
311
+ bar: baz;
312
+ // bip bop
313
+ // beep boop
314
+ // bap blimp
315
+ bang: bizz;
316
+ // bubble bubble
317
+ // toil trouble
318
+ // gorp
319
+ }
320
+ SCSS
321
+ foo
322
+ bar: baz
323
+ // bip bop
324
+ beep boop
325
+ bap blimp
326
+ bang: bizz
327
+ // bubble bubble
328
+ toil trouble
329
+ gorp
330
+ SASS
331
+ end
332
+
289
333
  def test_loud_comments
290
334
  assert_renders <<SASS, <<SCSS
291
335
  /* foo
@@ -354,6 +398,48 @@ foo bar {
354
398
  SCSS
355
399
  end
356
400
 
401
+ def test_nested_loud_comments
402
+ assert_renders <<SASS, <<SCSS
403
+ foo
404
+ bar: baz
405
+ /* bip bop
406
+ * beep boop
407
+ bang: bizz
408
+ /* bubble bubble
409
+ * toil trouble
410
+ SASS
411
+ foo {
412
+ bar: baz;
413
+ /* bip bop
414
+ * beep boop */
415
+ bang: bizz;
416
+ /* bubble bubble
417
+ * toil trouble */ }
418
+ SCSS
419
+
420
+ assert_sass_to_scss <<SCSS, <<SASS
421
+ foo {
422
+ bar: baz;
423
+ /* bip bop
424
+ * beep boop
425
+ * bap blimp */
426
+ bang: bizz;
427
+ /* bubble bubble
428
+ * toil trouble
429
+ * gorp */ }
430
+ SCSS
431
+ foo
432
+ bar: baz
433
+ /* bip bop
434
+ beep boop
435
+ bap blimp
436
+ bang: bizz
437
+ /* bubble bubble
438
+ toil trouble
439
+ gorp
440
+ SASS
441
+ end
442
+
357
443
  def test_loud_comments_with_weird_indentation
358
444
  assert_scss_to_sass <<SASS, <<SCSS
359
445
  foo
@@ -595,8 +681,8 @@ SCSS
595
681
  end
596
682
 
597
683
  def test_import_as_directive_in_sass
598
- assert_sass_to_sass '@import "foo.css"'
599
- assert_sass_to_sass '@import url(foo.css)'
684
+ assert_equal "@import foo.css\n", to_sass('@import "foo.css"')
685
+ assert_equal "@import foo.css\n", to_sass('@import url(foo.css)')
600
686
  end
601
687
 
602
688
  def test_import_as_directive_in_scss
@@ -3,7 +3,8 @@ $preconst: hello
3
3
  =premixin
4
4
  pre-mixin: here
5
5
 
6
- @import importee.sass, scss_importee, "basic.sass", basic.css, ../results/complex.css, url(partial.sass)
6
+ @import importee.sass, scss_importee, "basic.sass", basic.css, ../results/complex.css
7
+ @import url(partial.sass)
7
8
 
8
9
  nonimported
9
10
  :myconst $preconst
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 2
11
- version: 3.0.0.beta.2
10
+ - 3
11
+ version: 3.0.0.beta.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Nathan Weizenbaum
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-04-11 00:00:00 -07:00
20
+ date: 2010-04-14 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency