haml-edge 3.1.50 → 3.1.51

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.50
1
+ 3.1.51
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.50
1
+ 3.1.51
data/lib/haml/exec.rb CHANGED
@@ -388,9 +388,6 @@ END
388
388
  ::Sass::Plugin.options.merge! @options[:for_engine]
389
389
  ::Sass::Plugin.options[:unix_newlines] = @options[:unix_newlines]
390
390
 
391
- p [colon_path?(@args[0]), split_colon_path(@args[0])]
392
- exit
393
-
394
391
  if @args[1] && !colon_path?(@args[0])
395
392
  flag = @options[:update] ? "--update" : "--watch"
396
393
  err =
@@ -446,7 +443,7 @@ MSG
446
443
 
447
444
  def split_colon_path(path)
448
445
  one, two = path.split(':', 2)
449
- if one && two && #::Haml::Util.windows? &&
446
+ if one && two && ::Haml::Util.windows? &&
450
447
  one =~ /\A[A-Za-z]\Z/ && two =~ /\A[\/\\]/
451
448
  # If we're on Windows and we were passed a drive letter path,
452
449
  # don't split on that colon.
data/lib/sass/engine.rb CHANGED
@@ -592,25 +592,38 @@ WARNING
592
592
  raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.",
593
593
  :line => @line + 1) unless line.children.empty?
594
594
 
595
- if (match = value.match(Sass::SCSS::RX::STRING) || value.match(Sass::SCSS::RX::URI)) &&
596
- match.offset(0).first == 0 && !match.post_match.strip.empty? &&
597
- match.post_match.strip[0] != ?,
598
- # @import "filename" media-type
599
- return Tree::DirectiveNode.new("@import #{value}")
600
- end
595
+ scanner = StringScanner.new(value)
596
+ values = []
601
597
 
602
- value.split(/,\s*/).map do |f|
603
- if f =~ Sass::SCSS::RX::URI
604
- # All url()s are literal CSS @imports
605
- next Tree::DirectiveNode.new("@import #{f}")
606
- elsif f =~ Sass::SCSS::RX::STRING
607
- f = $1 || $2
598
+ loop do
599
+ unless node = parse_import_arg(scanner)
600
+ raise SyntaxError.new("Invalid @import: expected file to import, was #{scanner.rest.inspect}",
601
+ :line => @line)
608
602
  end
603
+ values << node
604
+ break unless scanner.scan(/,\s*/)
605
+ end
606
+
607
+ return values
608
+ end
609
609
 
610
- # http:// URLs are always literal CSS imports
611
- next Tree::DirectiveNode.new("@import url(#{f})") if f =~ /^http:\/\//
610
+ def parse_import_arg(scanner)
611
+ return if scanner.eos?
612
+ unless (str = scanner.scan(Sass::SCSS::RX::STRING)) ||
613
+ (uri = scanner.scan(Sass::SCSS::RX::URI))
614
+ return Tree::ImportNode.new(scanner.scan(/[^,]+/))
615
+ end
612
616
 
613
- Tree::ImportNode.new(f)
617
+ val = scanner[1] || scanner[2]
618
+ scanner.scan(/\s*/)
619
+ if media = scanner.scan(/[^,].*/)
620
+ Tree::DirectiveNode.new("@import #{str || uri} #{media}")
621
+ elsif uri
622
+ Tree::DirectiveNode.new("@import #{uri}")
623
+ elsif val =~ /^http:\/\//
624
+ Tree::DirectiveNode.new("@import url(#{val})")
625
+ else
626
+ Tree::ImportNode.new(val)
614
627
  end
615
628
  end
616
629
 
@@ -118,7 +118,7 @@ HAML
118
118
  # This is usually provided by ActionController::Base.
119
119
  def @base.protect_against_forgery?; false; end
120
120
  assert_equal(<<HTML, render(<<HAML, :action_view))
121
- <form action="foo" method="post">
121
+ <form #{rails_form_attr}action="foo" method="post">#{rails_form_opener}
122
122
  <p>bar</p>
123
123
  <strong>baz</strong>
124
124
  </form>
@@ -167,7 +167,7 @@ HAML
167
167
  def @base.protect_against_forgery?; false; end
168
168
  error_class = Haml::Util.ap_geq_3? ? "field_with_errors" : "fieldWithErrors"
169
169
  assert_equal(<<HTML, render(<<HAML, :action_view))
170
- <form action="" method="post">
170
+ <form #{rails_form_attr}action="" method="post">#{rails_form_opener}
171
171
  <div class="#{error_class}"><label for="post_error_field">Error field</label></div>
172
172
  </form>
173
173
  HTML
@@ -45,29 +45,6 @@ click
45
45
  <p>baz</p>
46
46
  <p>boom</p>
47
47
  foo
48
- <p>
49
- <form action="" method="post">
50
- </p>
51
- <div>
52
- <form action="" method="post">
53
- <div><input name="commit" type="submit" value="save" /></div>
54
- <p>
55
- @foo =
56
- value one
57
- </p>
58
- Toplevel? false
59
- <p>
60
- @foo =
61
- value three
62
- </p>
63
- </form>
64
- <form action="" method="post">
65
- Title:
66
- <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
67
- Body:
68
- <input id="article_body" name="article[body]" size="30" type="text" value="World" />
69
- </form>
70
- </div>
71
48
  <li><a href='http://www.google.com'>google</a></li>
72
49
  <p>
73
50
  foo
@@ -280,7 +280,7 @@ END
280
280
  def test_av_block_deprecation_warning
281
281
  assert_warning(/^DEPRECATION WARNING: - style block helpers are deprecated\. Please use =\./) do
282
282
  assert_equal <<HTML, render(<<HAML, :action_view)
283
- <form action="" method="post">
283
+ <form #{rails_form_attr}action="" method="post">#{rails_form_opener}
284
284
  Title:
285
285
  <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
286
286
  Body:
@@ -379,7 +379,7 @@ HAML
379
379
 
380
380
  def test_xss_protection_with_form_for
381
381
  assert_equal(<<HTML, render(<<HAML, :action_view))
382
- <form action="" method="post">
382
+ <form #{rails_form_attr}action="" method="post">#{rails_form_opener}
383
383
  Title:
384
384
  <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
385
385
  Body:
@@ -35,72 +35,6 @@ click
35
35
  %p boom
36
36
  - concat "foo\n"
37
37
  - haml_buffer.tabulation = 0
38
- -#
39
- -# ActionPack pre-2.0 has weird url_for issues here.
40
- - if ActionPack::VERSION::MAJOR < 2
41
- :plain
42
- <p>
43
- <form action="" method="post">
44
- </p>
45
- <div>
46
- <form action="" method="post">
47
- <div><input name="commit" type="submit" value="save" /></div>
48
- <p>
49
- @foo =
50
- value one
51
- </p>
52
- Toplevel? false
53
- <p>
54
- @foo =
55
- value three
56
- </p>
57
- </form>
58
- <form action="" method="post">
59
- Title:
60
- <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
61
- Body:
62
- <input id="article_body" name="article[body]" size="30" type="text" value="World" />
63
- </form>
64
- </div>
65
- - elsif Haml::Util.ap_geq?("3.0.0.beta3")
66
- %p
67
- = form_tag ''
68
- %div
69
- = form_tag '' do
70
- %div= submit_tag 'save'
71
- - @foo = 'value one'
72
- = test_partial 'partial'
73
- = form_for @article, :as => :article, :url => '', :html => {:class => nil, :id => nil} do |f|
74
- Title:
75
- = f.text_field :title
76
- Body:
77
- = f.text_field :body
78
- - elsif Haml::Util.ap_geq_3?
79
- %p
80
- = form_tag ''
81
- %div
82
- = form_tag '' do
83
- %div= submit_tag 'save'
84
- - @foo = 'value one'
85
- = test_partial 'partial'
86
- = form_for :article, @article, :url => '' do |f|
87
- Title:
88
- = f.text_field :title
89
- Body:
90
- = f.text_field :body
91
- - else
92
- %p
93
- = form_tag ''
94
- %div
95
- - form_tag '' do
96
- %div= submit_tag 'save'
97
- - @foo = 'value one'
98
- = test_partial 'partial'
99
- - form_for :article, @article, :url => '' do |f|
100
- Title:
101
- = f.text_field :title
102
- Body:
103
- = f.text_field :body
104
38
  = list_of({:google => 'http://www.google.com'}) do |name, link|
105
39
  %a{ :href => link }= name
106
40
  %p
@@ -493,6 +493,12 @@ CSS
493
493
  def test_media_import
494
494
  assert_equal("@import \"./fonts.sass\" all;\n",
495
495
  render("@import \"./fonts.sass\" all"))
496
+ assert_equal(<<CSS, render(<<SASS))
497
+ @import "./fonts.sass" all;
498
+ @import url(./fonts.scss);
499
+ CSS
500
+ @import "./fonts.sass" all, url(./fonts.scss)
501
+ SASS
496
502
  end
497
503
 
498
504
  def test_http_import
@@ -2044,6 +2050,14 @@ SASS
2044
2050
  end
2045
2051
  end
2046
2052
 
2053
+ def test_import_with_commas_in_url
2054
+ assert_equal <<CSS, render(<<SASS)
2055
+ @import url(foo.css?bar,baz);
2056
+ CSS
2057
+ @import url(foo.css?bar,baz)
2058
+ SASS
2059
+ end
2060
+
2047
2061
  # Encodings
2048
2062
 
2049
2063
  unless Haml::Util.ruby1_8?
data/test/test_helper.rb CHANGED
@@ -68,4 +68,14 @@ class Test::Unit::TestCase
68
68
  return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3?
69
69
  return ":#{name}, @#{name}"
70
70
  end
71
+
72
+ def rails_form_attr
73
+ return 'accept-charset="UTF-8" ' if Haml::Util.ap_geq?("3.0.0.rc")
74
+ return ''
75
+ end
76
+
77
+ def rails_form_opener
78
+ return '' unless Haml::Util.ap_geq?("3.0.0.rc")
79
+ return '<div style="margin:0;padding:0;display:inline"><input name="_snowman" type="hidden" value="&#9731;" /></div>'
80
+ end
71
81
  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.50
4
+ version: 3.1.51
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-07-26 00:00:00 -04:00
14
+ date: 2010-07-28 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -289,7 +289,6 @@ files:
289
289
  - test/sass/scss/test_helper.rb
290
290
  - test/sass/templates/_partial.sass
291
291
  - test/sass/templates/alt.sass
292
- - test/sass/templates/basic.sass
293
292
  - test/sass/templates/bork1.sass
294
293
  - test/sass/templates/bork2.sass
295
294
  - test/sass/templates/bork3.sass
@@ -1,23 +0,0 @@
1
-
2
-
3
- body
4
- :font Arial
5
- :background blue
6
-
7
- #page
8
- :width 700px
9
- :height 100
10
- #header
11
- :height 300px
12
- h1
13
- :font-size 50px
14
- :color blue
15
-
16
- #content.user.show
17
- #container.top
18
- #column.left
19
- :width 100px
20
- #column.right
21
- :width 600px
22
- #container.bottom
23
- :background brown