haml 3.0.0.beta.3 → 3.0.0.rc.1
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/.yardopts +2 -0
- data/REMEMBER +4 -11
- data/Rakefile +24 -2
- data/VERSION +1 -1
- data/lib/haml.rb +5 -2
- data/lib/haml/exec.rb +11 -4
- data/lib/haml/filters.rb +3 -0
- data/lib/haml/helpers.rb +2 -10
- data/lib/haml/helpers/action_view_extensions.rb +4 -2
- data/lib/haml/helpers/action_view_mods.rb +6 -4
- data/lib/haml/html.rb +0 -1
- data/lib/haml/precompiler.rb +37 -30
- data/lib/haml/railtie.rb +6 -2
- data/lib/haml/root.rb +4 -0
- data/lib/haml/template.rb +2 -0
- data/lib/haml/util.rb +74 -0
- data/lib/haml/util/subset_map.rb +101 -0
- data/lib/sass.rb +1 -0
- data/lib/sass/engine.rb +36 -31
- data/lib/sass/files.rb +1 -1
- data/lib/sass/plugin.rb +21 -0
- data/lib/sass/plugin/staleness_checker.rb +9 -9
- data/lib/sass/script.rb +1 -2
- data/lib/sass/script/color.rb +4 -3
- data/lib/sass/script/css_lexer.rb +11 -1
- data/lib/sass/script/css_parser.rb +4 -1
- data/lib/sass/script/funcall.rb +9 -0
- data/lib/sass/script/interpolation.rb +21 -0
- data/lib/sass/script/lexer.rb +30 -13
- data/lib/sass/script/node.rb +1 -1
- data/lib/sass/script/number.rb +4 -5
- data/lib/sass/script/parser.rb +13 -14
- data/lib/sass/script/string.rb +8 -2
- data/lib/sass/script/string_interpolation.rb +27 -4
- data/lib/sass/scss.rb +3 -0
- data/lib/sass/scss/css_parser.rb +5 -3
- data/lib/sass/scss/parser.rb +146 -64
- data/lib/sass/scss/rx.rb +9 -1
- data/lib/sass/scss/sass_parser.rb +11 -0
- data/lib/sass/scss/script_lexer.rb +2 -0
- data/lib/sass/scss/static_parser.rb +48 -0
- data/lib/sass/selector.rb +353 -0
- data/lib/sass/selector/abstract_sequence.rb +40 -0
- data/lib/sass/selector/comma_sequence.rb +80 -0
- data/lib/sass/selector/sequence.rb +194 -0
- data/lib/sass/selector/simple.rb +107 -0
- data/lib/sass/selector/simple_sequence.rb +161 -0
- data/lib/sass/tree/comment_node.rb +1 -0
- data/lib/sass/tree/debug_node.rb +1 -0
- data/lib/sass/tree/directive_node.rb +1 -0
- data/lib/sass/tree/extend_node.rb +60 -0
- data/lib/sass/tree/for_node.rb +1 -0
- data/lib/sass/tree/if_node.rb +2 -0
- data/lib/sass/tree/import_node.rb +2 -0
- data/lib/sass/tree/mixin_def_node.rb +1 -0
- data/lib/sass/tree/mixin_node.rb +21 -5
- data/lib/sass/tree/node.rb +59 -12
- data/lib/sass/tree/prop_node.rb +20 -21
- data/lib/sass/tree/root_node.rb +8 -17
- data/lib/sass/tree/rule_node.rb +49 -100
- data/lib/sass/tree/variable_node.rb +1 -0
- data/lib/sass/tree/warn_node.rb +1 -0
- data/lib/sass/tree/while_node.rb +1 -0
- data/test/haml/engine_test.rb +185 -3
- data/test/haml/helper_test.rb +25 -2
- data/test/haml/template_test.rb +2 -2
- data/test/haml/templates/helpers.haml +13 -0
- data/test/haml/util/subset_map_test.rb +91 -0
- data/test/haml/util_test.rb +25 -0
- data/test/sass/conversion_test.rb +23 -3
- data/test/sass/engine_test.rb +50 -7
- data/test/sass/extend_test.rb +1045 -0
- data/test/sass/results/complex.css +0 -1
- data/test/sass/results/script.css +1 -1
- data/test/sass/script_conversion_test.rb +16 -0
- data/test/sass/script_test.rb +37 -4
- data/test/sass/scss/css_test.rb +17 -3
- data/test/sass/scss/rx_test.rb +1 -1
- data/test/sass/scss/scss_test.rb +30 -0
- data/test/sass/templates/complex.sass +0 -2
- data/test/test_helper.rb +5 -0
- metadata +18 -4
@@ -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
|
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 = {})
|
data/test/sass/script_test.rb
CHANGED
@@ -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,
|
data/test/sass/scss/css_test.rb
CHANGED
@@ -157,7 +157,7 @@ SCSS
|
|
157
157
|
|
158
158
|
def test_selector_comments
|
159
159
|
assert_equal <<CSS, render(<<SCSS)
|
160
|
-
.foo
|
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
|
-
|
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('
|
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')
|
data/test/sass/scss/rx_test.rb
CHANGED
@@ -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(
|
96
|
+
assert_match URI, "url(#\\%&**+,-./0123456789~)"
|
97
97
|
end
|
98
98
|
|
99
99
|
def test_invalid_uri
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -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
|
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
@@ -6,9 +6,9 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 3
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
-
|
11
|
-
version: 3.0.0.
|
9
|
+
- rc
|
10
|
+
- 1
|
11
|
+
version: 3.0.0.rc.1
|
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-
|
20
|
+
date: 2010-04-26 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/sass/repl.rb
|
93
93
|
- lib/sass/tree/comment_node.rb
|
94
94
|
- lib/sass/tree/node.rb
|
95
|
+
- lib/sass/tree/extend_node.rb
|
95
96
|
- lib/sass/tree/for_node.rb
|
96
97
|
- lib/sass/tree/warn_node.rb
|
97
98
|
- lib/sass/tree/debug_node.rb
|
@@ -111,10 +112,18 @@ files:
|
|
111
112
|
- lib/sass/plugin/staleness_checker.rb
|
112
113
|
- lib/sass/environment.rb
|
113
114
|
- lib/sass/callbacks.rb
|
115
|
+
- lib/sass/selector/simple_sequence.rb
|
116
|
+
- lib/sass/selector/abstract_sequence.rb
|
117
|
+
- lib/sass/selector/comma_sequence.rb
|
118
|
+
- lib/sass/selector/sequence.rb
|
119
|
+
- lib/sass/selector/simple.rb
|
120
|
+
- lib/sass/selector.rb
|
114
121
|
- lib/sass/files.rb
|
115
122
|
- lib/sass/scss.rb
|
116
123
|
- lib/sass/engine.rb
|
117
124
|
- lib/sass/plugin.rb
|
125
|
+
- lib/sass/scss/static_parser.rb
|
126
|
+
- lib/sass/scss/sass_parser.rb
|
118
127
|
- lib/sass/scss/rx.rb
|
119
128
|
- lib/sass/scss/script_lexer.rb
|
120
129
|
- lib/sass/scss/parser.rb
|
@@ -124,6 +133,7 @@ files:
|
|
124
133
|
- lib/haml/exec.rb
|
125
134
|
- lib/haml/railtie.rb
|
126
135
|
- lib/haml/error.rb
|
136
|
+
- lib/haml/util/subset_map.rb
|
127
137
|
- lib/haml/html/erb.rb
|
128
138
|
- lib/haml/template.rb
|
129
139
|
- lib/haml/shared.rb
|
@@ -181,6 +191,7 @@ files:
|
|
181
191
|
- test/sass/script_test.rb
|
182
192
|
- test/sass/css2sass_test.rb
|
183
193
|
- test/sass/script_conversion_test.rb
|
194
|
+
- test/sass/extend_test.rb
|
184
195
|
- test/sass/data/hsl-rgb.txt
|
185
196
|
- test/sass/results/warn_imported.css
|
186
197
|
- test/sass/results/units.css
|
@@ -261,6 +272,7 @@ files:
|
|
261
272
|
- test/haml/spec/tests.json
|
262
273
|
- test/haml/html2haml_test.rb
|
263
274
|
- test/haml/template_test.rb
|
275
|
+
- test/haml/util/subset_map_test.rb
|
264
276
|
- test/haml/helper_test.rb
|
265
277
|
- test/haml/results/tag_parsing.xhtml
|
266
278
|
- test/haml/results/content_for_layout.xhtml
|
@@ -375,6 +387,7 @@ test_files:
|
|
375
387
|
- test/sass/script_test.rb
|
376
388
|
- test/sass/css2sass_test.rb
|
377
389
|
- test/sass/script_conversion_test.rb
|
390
|
+
- test/sass/extend_test.rb
|
378
391
|
- test/sass/conversion_test.rb
|
379
392
|
- test/sass/callbacks_test.rb
|
380
393
|
- test/sass/functions_test.rb
|
@@ -388,5 +401,6 @@ test_files:
|
|
388
401
|
- test/haml/spec/ruby_haml_test.rb
|
389
402
|
- test/haml/html2haml_test.rb
|
390
403
|
- test/haml/template_test.rb
|
404
|
+
- test/haml/util/subset_map_test.rb
|
391
405
|
- test/haml/helper_test.rb
|
392
406
|
- test/haml/engine_test.rb
|