haml-edge 2.3.179 → 2.3.180

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/README.md +88 -149
  3. data/VERSION +1 -1
  4. data/bin/css2sass +7 -1
  5. data/bin/sass-convert +7 -0
  6. data/lib/haml/exec.rb +95 -22
  7. data/lib/haml/template.rb +1 -1
  8. data/lib/haml/util.rb +50 -0
  9. data/lib/sass.rb +1 -1
  10. data/lib/sass/css.rb +38 -210
  11. data/lib/sass/engine.rb +121 -47
  12. data/lib/sass/files.rb +28 -19
  13. data/lib/sass/plugin.rb +32 -43
  14. data/lib/sass/repl.rb +1 -1
  15. data/lib/sass/script.rb +25 -6
  16. data/lib/sass/script/bool.rb +1 -0
  17. data/lib/sass/script/color.rb +2 -2
  18. data/lib/sass/script/css_lexer.rb +22 -0
  19. data/lib/sass/script/css_parser.rb +28 -0
  20. data/lib/sass/script/funcall.rb +17 -9
  21. data/lib/sass/script/functions.rb +46 -1
  22. data/lib/sass/script/interpolation.rb +42 -0
  23. data/lib/sass/script/lexer.rb +142 -34
  24. data/lib/sass/script/literal.rb +28 -12
  25. data/lib/sass/script/node.rb +57 -1
  26. data/lib/sass/script/number.rb +18 -3
  27. data/lib/sass/script/operation.rb +44 -8
  28. data/lib/sass/script/parser.rb +149 -24
  29. data/lib/sass/script/string.rb +50 -2
  30. data/lib/sass/script/unary_operation.rb +25 -10
  31. data/lib/sass/script/variable.rb +20 -11
  32. data/lib/sass/scss.rb +14 -0
  33. data/lib/sass/scss/css_parser.rb +39 -0
  34. data/lib/sass/scss/parser.rb +683 -0
  35. data/lib/sass/scss/rx.rb +112 -0
  36. data/lib/sass/scss/script_lexer.rb +13 -0
  37. data/lib/sass/scss/script_parser.rb +25 -0
  38. data/lib/sass/tree/comment_node.rb +58 -16
  39. data/lib/sass/tree/debug_node.rb +7 -2
  40. data/lib/sass/tree/directive_node.rb +38 -34
  41. data/lib/sass/tree/for_node.rb +6 -0
  42. data/lib/sass/tree/if_node.rb +13 -0
  43. data/lib/sass/tree/import_node.rb +26 -7
  44. data/lib/sass/tree/mixin_def_node.rb +18 -0
  45. data/lib/sass/tree/mixin_node.rb +16 -1
  46. data/lib/sass/tree/node.rb +98 -27
  47. data/lib/sass/tree/prop_node.rb +97 -20
  48. data/lib/sass/tree/root_node.rb +37 -0
  49. data/lib/sass/tree/rule_node.rb +88 -60
  50. data/lib/sass/tree/variable_node.rb +9 -5
  51. data/lib/sass/tree/while_node.rb +4 -0
  52. data/test/haml/results/filters.xhtml +1 -1
  53. data/test/haml/util_test.rb +28 -0
  54. data/test/sass/conversion_test.rb +884 -0
  55. data/test/sass/css2sass_test.rb +46 -21
  56. data/test/sass/engine_test.rb +680 -160
  57. data/test/sass/functions_test.rb +27 -0
  58. data/test/sass/more_results/more_import.css +1 -1
  59. data/test/sass/more_templates/more_import.sass +3 -3
  60. data/test/sass/plugin_test.rb +28 -8
  61. data/test/sass/results/compact.css +1 -1
  62. data/test/sass/results/complex.css +5 -5
  63. data/test/sass/results/compressed.css +1 -1
  64. data/test/sass/results/expanded.css +1 -1
  65. data/test/sass/results/import.css +3 -1
  66. data/test/sass/results/mixins.css +12 -12
  67. data/test/sass/results/nested.css +1 -1
  68. data/test/sass/results/parent_ref.css +4 -4
  69. data/test/sass/results/script.css +3 -3
  70. data/test/sass/results/scss_import.css +15 -0
  71. data/test/sass/results/scss_importee.css +2 -0
  72. data/test/sass/script_conversion_test.rb +153 -0
  73. data/test/sass/script_test.rb +44 -54
  74. data/test/sass/scss/css_test.rb +811 -0
  75. data/test/sass/scss/rx_test.rb +156 -0
  76. data/test/sass/scss/scss_test.rb +871 -0
  77. data/test/sass/scss/test_helper.rb +37 -0
  78. data/test/sass/templates/alt.sass +2 -2
  79. data/test/sass/templates/bork1.sass +1 -1
  80. data/test/sass/templates/import.sass +4 -4
  81. data/test/sass/templates/importee.sass +3 -3
  82. data/test/sass/templates/line_numbers.sass +1 -1
  83. data/test/sass/templates/mixins.sass +2 -2
  84. data/test/sass/templates/nested_mixin_bork.sass +1 -1
  85. data/test/sass/templates/options.sass +1 -1
  86. data/test/sass/templates/parent_ref.sass +2 -2
  87. data/test/sass/templates/script.sass +69 -69
  88. data/test/sass/templates/scss_import.scss +10 -0
  89. data/test/sass/templates/scss_importee.scss +1 -0
  90. data/test/sass/templates/units.sass +10 -10
  91. data/test/test_helper.rb +4 -4
  92. metadata +27 -2
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
+ require 'sass/engine'
3
+
4
+ module ScssTestHelper
5
+ def assert_parses(scss)
6
+ assert_equal scss.rstrip, render(scss).rstrip
7
+ end
8
+
9
+ def assert_not_parses(expected, scss)
10
+ raise "Template must include <err> where an error is expected" unless scss.include?("<err>")
11
+
12
+ after, was = scss.split("<err>")
13
+ line = after.count("\n") + 1
14
+
15
+ after.gsub!(/\s*\n\s*$/, '')
16
+ after.gsub!(/.*\n/, '')
17
+ after = "..." + after[-15..-1] if after.size > 18
18
+
19
+ was.gsub!(/^\s*\n\s*/, '')
20
+ was.gsub!(/\n.*/, '')
21
+ was = was[0...15] + "..." if was.size > 18
22
+
23
+ to_render = scss.sub("<err>", "")
24
+ render(to_render)
25
+ assert(false, "Expected syntax error for:\n#{to_render}\n")
26
+ rescue Sass::SyntaxError => err
27
+ assert_equal("Invalid CSS after \"#{after}\": expected #{expected}, was \"#{was}\"",
28
+ err.message)
29
+ assert_equal line, err.sass_line
30
+ end
31
+
32
+ def render(scss, options = {})
33
+ options[:syntax] ||= :scss
34
+ munge_filename options
35
+ Sass::Engine.new(scss, options).render
36
+ end
37
+ end
@@ -12,5 +12,5 @@ h1
12
12
  color: red
13
13
  :background-color green
14
14
  const
15
- nosp= 1 + 2
16
- sp = 1 + 2
15
+ nosp: 1 + 2
16
+ sp : 1 + 2
@@ -1,2 +1,2 @@
1
1
  bork
2
- :bork= !bork
2
+ :bork $bork
@@ -1,11 +1,11 @@
1
- !preconst = "hello"
1
+ $preconst: hello
2
2
 
3
3
  =premixin
4
4
  pre-mixin: here
5
5
 
6
- @import importee.sass, basic.sass, basic.css, ../results/complex.css, partial.sass
6
+ @import importee.sass, scss_importee, basic.sass, basic.css, ../results/complex.css, partial.sass
7
7
 
8
8
  nonimported
9
- :myconst = !preconst
10
- :otherconst = !postconst
9
+ :myconst $preconst
10
+ :otherconst $postconst
11
11
  +postmixin
@@ -1,11 +1,11 @@
1
- !postconst = "goodbye"
1
+ $postconst: goodbye
2
2
 
3
3
  =postmixin
4
4
  post-mixin: here
5
5
 
6
6
  imported
7
- :otherconst = !preconst
8
- :myconst = !postconst
7
+ :otherconst $preconst
8
+ :myconst $postconst
9
9
  +premixin
10
10
 
11
11
  @import basic
@@ -5,7 +5,7 @@ foo
5
5
  squggle
6
6
  blat: bang
7
7
 
8
- !preconst = 12
8
+ $preconst: 12
9
9
 
10
10
  @import importee
11
11
 
@@ -1,10 +1,10 @@
1
- !yellow = #fc0
1
+ $yellow: #fc0
2
2
 
3
3
  =bordered
4
4
  :border
5
5
  :top
6
6
  :width 2px
7
- :color = !yellow
7
+ :color $yellow
8
8
  :left
9
9
  :width 1px
10
10
  :color #000
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
3
  =error-mixin
4
- width = 1px * 1em
4
+ width: 1px * 1em
5
5
 
6
6
  @import mixin_bork
@@ -1,2 +1,2 @@
1
1
  foo
2
- style= option("style")
2
+ style: option("style")
@@ -15,9 +15,9 @@ p, div
15
15
  :style solid
16
16
  :width 2em
17
17
  .ie7 &, .ie6 &
18
- :content string(Totally not cool.)
18
+ :content string("Totally not cool.")
19
19
  .firefox &
20
- :content string(Quite cool.)
20
+ :content string("Quite cool.")
21
21
 
22
22
  .wow, .snazzy
23
23
  :font-family fantasy
@@ -1,101 +1,101 @@
1
- !width = 10em + 20
2
- !color = #00ff98
3
- !main_text = #ffa
4
- !num = 10
5
- !dec = 10.2
6
- !dec_0 = 99.0
7
- !neg = -10
8
- !esc= 10"+12"
9
- !str= "Hello!"
10
- !qstr= "Quo\"ted\"!"
11
- !hstr= "Hyph-en!"
12
- !concat = "#{5 + 4} hi there"
13
- !percent= 11%
14
- !complex = 1px/1em
1
+ $width: 10em + 20
2
+ $color: #00ff98
3
+ $main_text: #ffa
4
+ $num: 10
5
+ $dec: 10.2
6
+ $dec_0: 99.0
7
+ $neg: -10
8
+ $esc: 10\+12
9
+ $str: Hello\!
10
+ $qstr: "Quo\"ted\"!"
11
+ $hstr: Hyph-en\!
12
+ $concat: #{5 + 4} hi there
13
+ $percent: 11%
14
+ $complex: 1px/1em
15
15
 
16
16
  #main
17
- :content = !str
18
- :qstr = !qstr
19
- :hstr = !hstr
20
- :width = !width
17
+ :content $str
18
+ :qstr $qstr
19
+ :hstr $hstr
20
+ :width $width
21
21
  :background-color #000
22
- :color= !main_text
23
- :short-color= #123
24
- :named-color= olive
25
- :con= "foo" bar (!concat "boom")
26
- :con2= "noquo" "quo"
22
+ :color $main_text
23
+ :short-color #123
24
+ :named-color olive
25
+ :con "foo" bar ($concat "boom")
26
+ :con2 "noquo" quo
27
27
  #sidebar
28
- :background-color= !color
28
+ :background-color $color
29
29
  :num
30
- :normal= !num
31
- :dec= !dec
32
- :dec0= !dec_0
33
- :neg= !neg
34
- :esc= !esc
35
- :many= 1 + 2 + 3
36
- :order= 1 + 2 * 3
37
- :complex= ((1 + 2) + 15)+#3a8b9f + ("hi"+(1 +1+ 2)* 4)
30
+ :normal $num
31
+ :dec $dec
32
+ :dec0 $dec_0
33
+ :neg $neg
34
+ :esc $esc
35
+ :many 1 + 2 + 3
36
+ :order 1 + 2 * 3
37
+ :complex ((1 + 2) + 15)+#3a8b9f + (hi+(1 +1+ 2)* 4)
38
38
 
39
39
  #plus
40
40
  :num
41
- :num= 5+2
42
- :num-un= 10em + 15em
43
- :num-un2= 10 + 13em
44
- :num-neg= 10 + -.13
45
- :str= 100 * 1px
46
- :col= 13 + #aaa
47
- :perc = !percent + 20%
41
+ :num 5+2
42
+ :num-un 10em + 15em
43
+ :num-un2 10 + 13em
44
+ :num-neg 10 + -.13
45
+ :str 100 * 1px
46
+ :col 13 + #aaa
47
+ :perc $percent + 20%
48
48
  :str
49
- :str= "hi" + "\ there"
50
- :str2= "hi" + " there"
51
- :col= "14em solid " + #123
52
- :num= "times: " + 13
49
+ :str "hi" + "\ there"
50
+ :str2 "hi" + " there"
51
+ :col "14em solid " + #123
52
+ :num "times: " + 13
53
53
  :col
54
- :num= #f02 + 123.5
55
- :col= #12A + #405162
54
+ :num #f02 + 123.5
55
+ :col #12A + #405162
56
56
 
57
57
  #minus
58
58
  :num
59
- :num= 912 - 12
59
+ :num 912 - 12
60
60
  :col
61
- :num= #fffffa - 5.2
62
- :col= #abcdef - #fedcba
61
+ :num #fffffa - 5.2
62
+ :col #abcdef - #fedcba
63
63
  :unary
64
- :num= -1
65
- :const= -!neg
66
- :paren= -(5 + 6)
67
- :two= --12
68
- :many= --------12
69
- :crazy= -----(5 + ---!neg)
64
+ :num -1
65
+ :const -$neg
66
+ :paren -(5 + 6)
67
+ :two --12
68
+ :many --------12
69
+ :crazy -----(5 + ---$neg)
70
70
 
71
71
  #times
72
72
  :num
73
- :num= 2 * 3.5
74
- :col= 2 * #3a4b5c
73
+ :num 2 * 3.5
74
+ :col 2 * #3a4b5c
75
75
  :col
76
- :num= #12468a * 0.5
77
- :col= #121212 * #020304
76
+ :num #12468a * 0.5
77
+ :col #121212 * #020304
78
78
 
79
79
  #div
80
80
  :num
81
- :num= 10 / 3.0
82
- :num2= 10 / 3
81
+ :num (10 / 3.0)
82
+ :num2 (10 / 3)
83
83
  :col
84
- :num= #12468a / 2
85
- :col= #abcdef / #0f0f0f
86
- :comp = !complex * 1em
84
+ :num #12468a / 2
85
+ :col #abcdef / #0f0f0f
86
+ :comp $complex * 1em
87
87
 
88
88
  #mod
89
89
  :num
90
- :num= 17 % 3
90
+ :num 17 % 3
91
91
  :col
92
- :col= #5f6e7d % #10200a
93
- :num= #aaabac % 3
92
+ :col #5f6e7d % #10200a
93
+ :num #aaabac % 3
94
94
 
95
95
  #const
96
96
  :escaped
97
- :quote = "!foo"
98
- :default = !str !important
97
+ :quote \$foo \!bar
98
+ :default $str !important
99
99
 
100
100
  #regression
101
- :a= (3 + 2) - 1
101
+ :a (3 + 2) - 1
@@ -0,0 +1,10 @@
1
+ $preconst: hello;
2
+
3
+ @mixin premixin {pre-mixin: here}
4
+
5
+ @import "importee.sass";
6
+
7
+ nonimported {
8
+ myconst: $preconst;
9
+ otherconst: $postconst;
10
+ @include postmixin; }
@@ -0,0 +1 @@
1
+ scss {imported: yes}
@@ -1,11 +1,11 @@
1
1
  b
2
- :foo= 0.5 * 10px
3
- :bar= 10zzz * 12px / 5zzz
4
- :baz= percentage(12.0px / 18px)
5
- :many-units= 10.0zzz / 3yyy * 12px / 5zzz * 3yyy / 3px * 4em
6
- :mm= 5mm + 1cm
7
- :pc= 1pc + 12pt
8
- :pt= 72pt - 2in
9
- :inches= 1in + 2.54cm
10
- :more-inches= 1in + ((72pt * 2in) + (36pt * 1in)) / 2.54cm
11
- :mixed= (1 + (1em * 6px / 3in)) * 4in / 2em
2
+ :foo 0.5 * 10px
3
+ :bar 10zzz * 12px / 5zzz
4
+ :baz percentage(12.0px / 18px)
5
+ :many-units 10.0zzz / 3yyy * 12px / 5zzz * 3yyy / 3px * 4em
6
+ :mm 5mm + 1cm
7
+ :pc 1pc + 12pt
8
+ :pt 72pt - 2in
9
+ :inches 1in + 2.54cm
10
+ :more-inches 1in + ((72pt * 2in) + (36pt * 1in)) / 2.54cm
11
+ :mixed (1 + (1em * 6px / 3in)) * 4in / 2em
data/test/test_helper.rb CHANGED
@@ -19,18 +19,18 @@ module Sass::Script::Functions
19
19
  end
20
20
 
21
21
  class Test::Unit::TestCase
22
- def munge_filename(opts)
22
+ def munge_filename(opts = {})
23
23
  return if opts.has_key?(:filename)
24
- opts[:filename] = filename_for_test
24
+ opts[:filename] = filename_for_test(opts[:syntax] || :sass)
25
25
  end
26
26
 
27
- def filename_for_test
27
+ def filename_for_test(syntax = :sass)
28
28
  test_name = caller.
29
29
  map {|c| Haml::Util.caller_info(c)[2]}.
30
30
  compact.
31
31
  map {|c| c.sub(/^(block|rescue) in /, '')}.
32
32
  find {|c| c =~ /^test_/}
33
- "#{test_name}_inline.sass"
33
+ "#{test_name}_inline.#{syntax}"
34
34
  end
35
35
 
36
36
  def clean_up_sassc
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.179
4
+ version: 2.3.180
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-03-30 00:00:00 -04:00
13
+ date: 2010-03-31 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,9 @@ files:
99
99
  - lib/sass/script/string.rb
100
100
  - lib/sass/script/unary_operation.rb
101
101
  - lib/sass/script/variable.rb
102
+ - lib/sass/script/css_lexer.rb
103
+ - lib/sass/script/css_parser.rb
104
+ - lib/sass/script/interpolation.rb
102
105
  - lib/sass/tree/comment_node.rb
103
106
  - lib/sass/tree/debug_node.rb
104
107
  - lib/sass/tree/directive_node.rb
@@ -113,6 +116,12 @@ files:
113
116
  - lib/sass/tree/root_node.rb
114
117
  - lib/sass/tree/variable_node.rb
115
118
  - lib/sass/tree/while_node.rb
119
+ - lib/sass/scss.rb
120
+ - lib/sass/scss/css_parser.rb
121
+ - lib/sass/scss/parser.rb
122
+ - lib/sass/scss/rx.rb
123
+ - lib/sass/scss/script_lexer.rb
124
+ - lib/sass/scss/script_parser.rb
116
125
  - vendor/fssm/LICENSE
117
126
  - vendor/fssm/README.markdown
118
127
  - vendor/fssm/Rakefile
@@ -147,6 +156,7 @@ files:
147
156
  - bin/haml
148
157
  - bin/html2haml
149
158
  - bin/sass
159
+ - bin/sass-convert
150
160
  - test/benchmark.rb
151
161
  - test/haml/engine_test.rb
152
162
  - test/haml/helper_test.rb
@@ -244,6 +254,12 @@ files:
244
254
  - test/sass/results/subdir/nested_subdir/nested_subdir.css
245
255
  - test/sass/results/subdir/subdir.css
246
256
  - test/sass/results/units.css
257
+ - test/sass/results/scss_import.css
258
+ - test/sass/results/scss_importee.css
259
+ - test/sass/scss/css_test.rb
260
+ - test/sass/scss/rx_test.rb
261
+ - test/sass/scss/scss_test.rb
262
+ - test/sass/scss/test_helper.rb
247
263
  - test/sass/templates/_partial.sass
248
264
  - test/sass/templates/alt.sass
249
265
  - test/sass/templates/basic.sass
@@ -274,7 +290,11 @@ files:
274
290
  - test/sass/templates/subdir/nested_subdir/nested_subdir.sass
275
291
  - test/sass/templates/subdir/subdir.sass
276
292
  - test/sass/templates/units.sass
293
+ - test/sass/templates/scss_import.scss
294
+ - test/sass/templates/scss_importee.scss
277
295
  - test/sass/callbacks_test.rb
296
+ - test/sass/conversion_test.rb
297
+ - test/sass/script_conversion_test.rb
278
298
  - test/test_helper.rb
279
299
  - extra/haml-mode.el
280
300
  - extra/sass-mode.el
@@ -337,4 +357,9 @@ test_files:
337
357
  - test/sass/functions_test.rb
338
358
  - test/sass/plugin_test.rb
339
359
  - test/sass/script_test.rb
360
+ - test/sass/scss/css_test.rb
361
+ - test/sass/scss/rx_test.rb
362
+ - test/sass/scss/scss_test.rb
340
363
  - test/sass/callbacks_test.rb
364
+ - test/sass/conversion_test.rb
365
+ - test/sass/script_conversion_test.rb