haml 2.0.8 → 2.0.9
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 +1 -1
- data/lib/haml/helpers/action_view_mods.rb +1 -1
- data/lib/sass.rb +1 -0
- data/lib/sass/css.rb +2 -2
- data/lib/sass/tree/attr_node.rb +4 -0
- data/lib/sass/tree/node.rb +4 -0
- data/lib/sass/tree/rule_node.rb +4 -0
- data/lib/sass/tree/value_node.rb +4 -0
- data/test/haml/results/render_layout.xhtml +3 -0
- data/test/haml/template_test.rb +2 -1
- data/test/haml/templates/_layout.erb +3 -0
- data/test/haml/templates/render_layout.haml +2 -0
- data/test/sass/css2sass_test.rb +193 -0
- metadata +7 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.9
|
@@ -86,7 +86,7 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
|
|
86
86
|
else
|
87
87
|
module CaptureHelper
|
88
88
|
def capture_with_haml(*args, &block)
|
89
|
-
if
|
89
|
+
if Haml::Helpers.block_is_haml?(block)
|
90
90
|
capture_haml(*args, &block)
|
91
91
|
else
|
92
92
|
capture_without_haml(*args, &block)
|
data/lib/sass.rb
CHANGED
data/lib/sass/css.rb
CHANGED
@@ -311,7 +311,7 @@ module Sass
|
|
311
311
|
def remove_parent_refs(root)
|
312
312
|
root.children.each do |child|
|
313
313
|
if child.is_a?(Tree::RuleNode)
|
314
|
-
child.rule.gsub! /^&
|
314
|
+
child.rule.gsub! /^& +/, ''
|
315
315
|
remove_parent_refs child
|
316
316
|
end
|
317
317
|
end
|
@@ -377,7 +377,7 @@ module Sass
|
|
377
377
|
def fold_commas(root)
|
378
378
|
prev_rule = nil
|
379
379
|
root.children.map! do |child|
|
380
|
-
next child unless Tree::RuleNode
|
380
|
+
next child unless child.is_a?(Tree::RuleNode)
|
381
381
|
|
382
382
|
if prev_rule && prev_rule.children == child.children
|
383
383
|
prev_rule.rule << ", #{child.rule}"
|
data/lib/sass/tree/attr_node.rb
CHANGED
@@ -9,6 +9,10 @@ module Sass::Tree
|
|
9
9
|
super(value, style)
|
10
10
|
end
|
11
11
|
|
12
|
+
def ==(other)
|
13
|
+
self.class == other.class && name == other.name && super
|
14
|
+
end
|
15
|
+
|
12
16
|
def to_s(tabs, parent_name = nil)
|
13
17
|
if value[-1] == ?;
|
14
18
|
raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!).", @line)
|
data/lib/sass/tree/node.rb
CHANGED
data/lib/sass/tree/rule_node.rb
CHANGED
data/lib/sass/tree/value_node.rb
CHANGED
data/test/haml/template_test.rb
CHANGED
@@ -42,7 +42,8 @@ class TemplateTest < Test::Unit::TestCase
|
|
42
42
|
TEMPLATES = %w{ very_basic standard helpers
|
43
43
|
whitespace_handling original_engine list helpful
|
44
44
|
silent_script tag_parsing just_stuff partials
|
45
|
-
filters nuke_outer_whitespace nuke_inner_whitespace
|
45
|
+
filters nuke_outer_whitespace nuke_inner_whitespace
|
46
|
+
render_layout }
|
46
47
|
# partial layouts were introduced in 2.0.0
|
47
48
|
TEMPLATES << 'partial_layout' unless ActionPack::VERSION::MAJOR < 2
|
48
49
|
|
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
|
+
require 'sass/css'
|
4
|
+
|
5
|
+
class CSS2SassTest < Test::Unit::TestCase
|
6
|
+
def test_basic
|
7
|
+
css = <<CSS
|
8
|
+
h1 {
|
9
|
+
color: red;
|
10
|
+
}
|
11
|
+
CSS
|
12
|
+
assert_equal(<<SASS, css2sass(css))
|
13
|
+
h1
|
14
|
+
:color red
|
15
|
+
SASS
|
16
|
+
assert_equal(<<SASS, css2sass(css, :alternate => true))
|
17
|
+
h1
|
18
|
+
color: red
|
19
|
+
SASS
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_nesting
|
23
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
24
|
+
li
|
25
|
+
:display none
|
26
|
+
|
27
|
+
a
|
28
|
+
:text-decoration none
|
29
|
+
|
30
|
+
span
|
31
|
+
:color yellow
|
32
|
+
|
33
|
+
&:hover
|
34
|
+
:text-decoration underline
|
35
|
+
SASS
|
36
|
+
li {
|
37
|
+
display: none;
|
38
|
+
}
|
39
|
+
|
40
|
+
li a {
|
41
|
+
text-decoration: none;
|
42
|
+
}
|
43
|
+
|
44
|
+
li a span {
|
45
|
+
color: yellow;
|
46
|
+
}
|
47
|
+
|
48
|
+
li a:hover {
|
49
|
+
text-decoration: underline;
|
50
|
+
}
|
51
|
+
CSS
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_comments_multiline
|
55
|
+
css = <<CSS
|
56
|
+
/* comment */
|
57
|
+
elephant.rawr {
|
58
|
+
rampages: excessively;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* actual multiline
|
62
|
+
comment */
|
63
|
+
span.turkey {
|
64
|
+
isdinner: true;
|
65
|
+
}
|
66
|
+
|
67
|
+
.turducken {
|
68
|
+
/* Sounds funny
|
69
|
+
doesn't it */
|
70
|
+
chimera: not_really;
|
71
|
+
}
|
72
|
+
|
73
|
+
#overhere {
|
74
|
+
bored: sorta; /* it's for a good
|
75
|
+
cause */
|
76
|
+
better_than: thread_pools;
|
77
|
+
}
|
78
|
+
|
79
|
+
#one_more {
|
80
|
+
finally: srsly;
|
81
|
+
} /* just a line here */
|
82
|
+
CSS
|
83
|
+
sass = <<SASS
|
84
|
+
elephant.rawr
|
85
|
+
:rampages excessively
|
86
|
+
|
87
|
+
|
88
|
+
span.turkey
|
89
|
+
:isdinner true
|
90
|
+
|
91
|
+
|
92
|
+
.turducken
|
93
|
+
:chimera not_really
|
94
|
+
|
95
|
+
|
96
|
+
#overhere
|
97
|
+
:bored sorta
|
98
|
+
:better_than thread_pools
|
99
|
+
|
100
|
+
|
101
|
+
#one_more
|
102
|
+
:finally srsly
|
103
|
+
SASS
|
104
|
+
assert_equal(css2sass(css), sass)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_fold_commas
|
108
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
109
|
+
li
|
110
|
+
.one, .two
|
111
|
+
:color red
|
112
|
+
SASS
|
113
|
+
li .one {
|
114
|
+
color: red;
|
115
|
+
}
|
116
|
+
li .two {
|
117
|
+
color: red;
|
118
|
+
}
|
119
|
+
CSS
|
120
|
+
|
121
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
122
|
+
.one
|
123
|
+
:color green
|
124
|
+
|
125
|
+
|
126
|
+
.two
|
127
|
+
:color green
|
128
|
+
:color red
|
129
|
+
|
130
|
+
|
131
|
+
.three
|
132
|
+
:color red
|
133
|
+
SASS
|
134
|
+
.one, .two {
|
135
|
+
color: green;
|
136
|
+
}
|
137
|
+
|
138
|
+
.two, .three {
|
139
|
+
color: red;
|
140
|
+
}
|
141
|
+
CSS
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_bad_formatting
|
145
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
146
|
+
hello
|
147
|
+
:parent true
|
148
|
+
|
149
|
+
there
|
150
|
+
:parent false
|
151
|
+
|
152
|
+
who
|
153
|
+
:hoo false
|
154
|
+
|
155
|
+
why
|
156
|
+
:y true
|
157
|
+
|
158
|
+
when
|
159
|
+
:wen nao
|
160
|
+
|
161
|
+
|
162
|
+
down_here
|
163
|
+
:yeah true
|
164
|
+
SASS
|
165
|
+
hello {
|
166
|
+
parent: true;
|
167
|
+
}
|
168
|
+
|
169
|
+
hello there {
|
170
|
+
parent: false;
|
171
|
+
}
|
172
|
+
hello who {
|
173
|
+
hoo: false;
|
174
|
+
}
|
175
|
+
hello why {
|
176
|
+
y: true;
|
177
|
+
}
|
178
|
+
hello when {
|
179
|
+
wen: nao;
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
down_here { yeah: true; }
|
185
|
+
CSS
|
186
|
+
end
|
187
|
+
|
188
|
+
private
|
189
|
+
|
190
|
+
def css2sass(string, opts={})
|
191
|
+
Sass::CSS.new(string, opts).render
|
192
|
+
end
|
193
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
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: 2009-02-
|
13
|
+
date: 2009-02-21 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- test/linked_rails.rb
|
82
82
|
- test/benchmark.rb
|
83
83
|
- test/sass
|
84
|
+
- test/sass/css2sass_test.rb
|
84
85
|
- test/sass/results
|
85
86
|
- test/sass/results/constants.css
|
86
87
|
- test/sass/results/parent_ref.css
|
@@ -144,6 +145,7 @@ files:
|
|
144
145
|
- test/haml/results/eval_suppressed.xhtml
|
145
146
|
- test/haml/results/nuke_inner_whitespace.xhtml
|
146
147
|
- test/haml/results/whitespace_handling.xhtml
|
148
|
+
- test/haml/results/render_layout.xhtml
|
147
149
|
- test/haml/results/silent_script.xhtml
|
148
150
|
- test/haml/results/standard.xhtml
|
149
151
|
- test/haml/results/just_stuff.xhtml
|
@@ -161,10 +163,12 @@ files:
|
|
161
163
|
- test/haml/templates/_layout_for_partial.haml
|
162
164
|
- test/haml/templates/original_engine.haml
|
163
165
|
- test/haml/templates/helpers.haml
|
166
|
+
- test/haml/templates/_layout.erb
|
164
167
|
- test/haml/templates/action_view_ugly.haml
|
165
168
|
- test/haml/templates/content_for_layout.haml
|
166
169
|
- test/haml/templates/silent_script.haml
|
167
170
|
- test/haml/templates/very_basic.haml
|
171
|
+
- test/haml/templates/render_layout.haml
|
168
172
|
- test/haml/templates/filters.haml
|
169
173
|
- test/haml/templates/_av_partial_1.haml
|
170
174
|
- test/haml/templates/standard_ugly.haml
|
@@ -228,6 +232,7 @@ signing_key:
|
|
228
232
|
specification_version: 2
|
229
233
|
summary: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.
|
230
234
|
test_files:
|
235
|
+
- test/sass/css2sass_test.rb
|
231
236
|
- test/sass/engine_test.rb
|
232
237
|
- test/sass/plugin_test.rb
|
233
238
|
- test/haml/html2haml_test.rb
|