faml 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/Rakefile +8 -4
- data/ext/attribute_builder/attribute_builder.c +7 -2
- data/incompatibilities/README.md +3 -1
- data/incompatibilities/spec/render/array_attribute_spec.md +301 -0
- data/incompatibilities/spec/render/attribute_spec.md +43 -368
- data/incompatibilities/spec/render/hash_attribute_spec.md +120 -0
- data/lib/faml/version.rb +1 -1
- data/spec/render/array_attribute_spec.rb +85 -0
- data/spec/render/attribute_spec.rb +15 -154
- data/spec/render/hash_attribute_spec.rb +66 -0
- data/spec/spec_helper.rb +14 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efb487cc95863a4732f1771c0e634fe19c533d84
|
4
|
+
data.tar.gz: a2d406a2e67257ee76c8c847b52f9ac0c54a7bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fb7e5535a4c2f2e7f03a9fb79055d02191bd3b862e6e5e5b8b884c832d5a6c877776d9fb234367de6f03d751749ccb38bfb92a698cb1a0279779e88b78f40f5
|
7
|
+
data.tar.gz: cc47fb356f37cf92cfc5c402b63c29d9b3318667118ff33c8b0fb964219d4bf262bed7d1de9d175f7dc4d9f4ec6fc1162434eb581628a4d02a01fda65e46d595
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.6.4 (2015-11-28)
|
2
|
+
- Flatten `id` and `class` attributes
|
3
|
+
- https://github.com/eagletmt/faml/pull/41
|
4
|
+
|
1
5
|
## 0.6.3 (2015-11-22)
|
2
6
|
- Remove duplicated class in Ruby attribute case
|
3
7
|
- `%span.foo{h}` where `h = { class: 'foo bar' }` now renders `<span class='bar foo'></span>` .
|
data/Rakefile
CHANGED
@@ -20,8 +20,10 @@ namespace :benchmark do
|
|
20
20
|
namespace :rendering do
|
21
21
|
desc "Run rendering benchmark with Haml's standard template"
|
22
22
|
task :haml do
|
23
|
-
|
24
|
-
|
23
|
+
faml_spec = Gem::Specification.find_by_name('faml')
|
24
|
+
haml_req = faml_spec.dependencies.find { |dep| dep.name == 'haml' }.requirement
|
25
|
+
haml_spec = Gem::Specification.find_by_name('haml', haml_req)
|
26
|
+
standard_haml_path = File.join(haml_spec.gem_dir, 'test', 'templates', 'standard.haml')
|
25
27
|
sh 'ruby', 'benchmark/rendering.rb', standard_haml_path
|
26
28
|
end
|
27
29
|
|
@@ -40,8 +42,10 @@ namespace :benchmark do
|
|
40
42
|
namespace :compiling do
|
41
43
|
desc "Run compiling benchmark with Haml's standard template"
|
42
44
|
task :haml do
|
43
|
-
|
44
|
-
|
45
|
+
faml_spec = Gem::Specification.find_by_name('faml')
|
46
|
+
haml_req = faml_spec.dependencies.find { |dep| dep.name == 'haml' }.requirement
|
47
|
+
haml_spec = Gem::Specification.find_by_name('haml', haml_req)
|
48
|
+
standard_haml_path = File.join(haml_spec.gem_dir, 'test', 'templates', 'standard.haml')
|
45
49
|
sh 'ruby', 'benchmark/compiling.rb', standard_haml_path
|
46
50
|
end
|
47
51
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
#define FOREACH_FUNC(func) ((int (*)(ANYARGS))(func))
|
14
14
|
|
15
15
|
VALUE rb_mAttributeBuilder;
|
16
|
-
static ID id_keys, id_sort_bang, id_uniq_bang, id_merge_bang;
|
16
|
+
static ID id_keys, id_sort_bang, id_uniq_bang, id_merge_bang, id_flatten;
|
17
17
|
static ID id_id, id_class, id_underscore, id_hyphen, id_space, id_equal;
|
18
18
|
|
19
19
|
static void
|
@@ -26,7 +26,11 @@ concat_array_attribute(VALUE attributes, VALUE hash, VALUE key)
|
|
26
26
|
if (!NIL_P(v)) {
|
27
27
|
VALUE ary;
|
28
28
|
|
29
|
-
|
29
|
+
if (RB_TYPE_P(v, T_ARRAY)) {
|
30
|
+
v = rb_funcall(v, id_flatten, 0);
|
31
|
+
} else {
|
32
|
+
v = rb_Array(v);
|
33
|
+
}
|
30
34
|
ary = rb_hash_lookup(attributes, key);
|
31
35
|
Check_Type(ary, T_ARRAY);
|
32
36
|
rb_ary_concat(ary, v);
|
@@ -333,6 +337,7 @@ Init_attribute_builder(void)
|
|
333
337
|
id_sort_bang = rb_intern("sort!");
|
334
338
|
id_uniq_bang = rb_intern("uniq!");
|
335
339
|
id_merge_bang = rb_intern("merge!");
|
340
|
+
id_flatten = rb_intern("flatten");
|
336
341
|
|
337
342
|
id_id = rb_intern("ID");
|
338
343
|
id_class = rb_intern("CLASS");
|
data/incompatibilities/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Incompatibilities
|
2
2
|
## Versions
|
3
3
|
- Haml 4.1.0.beta.1
|
4
|
-
- Faml 0.6.
|
4
|
+
- Faml 0.6.4
|
5
5
|
- Hamlit 1.7.2
|
6
6
|
|
7
7
|
## Table of contents
|
8
8
|
- [spec/compiler_newline_spec.md](spec/compiler_newline_spec.md)
|
9
|
+
- [spec/render/array_attribute_spec.md](spec/render/array_attribute_spec.md)
|
9
10
|
- [spec/render/attribute_spec.md](spec/render/attribute_spec.md)
|
10
11
|
- [spec/render/comment_spec.md](spec/render/comment_spec.md) (Hamlit's incompatibility)
|
11
12
|
- [spec/render/doctype_spec.md](spec/render/doctype_spec.md)
|
@@ -17,6 +18,7 @@
|
|
17
18
|
- [spec/render/filters/markdown_spec.md](spec/render/filters/markdown_spec.md)
|
18
19
|
- [spec/render/filters/plain_spec.md](spec/render/filters/plain_spec.md)
|
19
20
|
- [spec/render/filters/preserve_spec.md](spec/render/filters/preserve_spec.md) (Hamlit's incompatibility)
|
21
|
+
- [spec/render/hash_attribute_spec.md](spec/render/hash_attribute_spec.md)
|
20
22
|
- [spec/render/helpers_spec.md](spec/render/helpers_spec.md) (Hamlit's incompatibility)
|
21
23
|
- [spec/render/multiline_spec.md](spec/render/multiline_spec.md) (Hamlit's incompatibility)
|
22
24
|
- [spec/render/newline_spec.md](spec/render/newline_spec.md) (Hamlit's incompatibility)
|
@@ -0,0 +1,301 @@
|
|
1
|
+
# [./spec/render/array_attribute_spec.rb:15](../../../spec/render/array_attribute_spec.rb#L15)
|
2
|
+
## Input
|
3
|
+
```haml
|
4
|
+
- h1 = {class: 'c1', id: ['id1', 'id3']}
|
5
|
+
- h2 = {class: [{}, 'c2'], id: 'id2'}
|
6
|
+
%span#main.content{h1, h2} hello
|
7
|
+
|
8
|
+
```
|
9
|
+
|
10
|
+
## Faml, Haml
|
11
|
+
```html
|
12
|
+
<span class='c1 c2 content {}' id='main_id1_id3_id2'>hello</span>
|
13
|
+
|
14
|
+
```
|
15
|
+
|
16
|
+
## Hamlit
|
17
|
+
```html
|
18
|
+
<span class='c1 content c2 {}' id='main_id1_id3_id2'>hello</span>
|
19
|
+
|
20
|
+
```
|
21
|
+
|
22
|
+
# [./spec/render/array_attribute_spec.rb:23](../../../spec/render/array_attribute_spec.rb#L23)
|
23
|
+
## Input
|
24
|
+
```haml
|
25
|
+
%span.foo{class: "foo bar"}
|
26
|
+
```
|
27
|
+
|
28
|
+
## Faml, Haml
|
29
|
+
```html
|
30
|
+
<span class='bar foo'></span>
|
31
|
+
|
32
|
+
```
|
33
|
+
|
34
|
+
## Hamlit
|
35
|
+
```html
|
36
|
+
<span class='foo bar foo'></span>
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
# [./spec/render/array_attribute_spec.rb:23](../../../spec/render/array_attribute_spec.rb#L23)
|
41
|
+
## Input
|
42
|
+
```haml
|
43
|
+
- v = "foo bar"
|
44
|
+
%span.foo{class: v}
|
45
|
+
```
|
46
|
+
|
47
|
+
## Faml, Haml
|
48
|
+
```html
|
49
|
+
<span class='bar foo'></span>
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
## Hamlit
|
54
|
+
```html
|
55
|
+
<span class='foo foo bar'></span>
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
# [./spec/render/array_attribute_spec.rb:23](../../../spec/render/array_attribute_spec.rb#L23)
|
60
|
+
## Input
|
61
|
+
```haml
|
62
|
+
- h = {class: "foo bar"}
|
63
|
+
%span.foo{h}
|
64
|
+
```
|
65
|
+
|
66
|
+
## Faml, Haml
|
67
|
+
```html
|
68
|
+
<span class='bar foo'></span>
|
69
|
+
|
70
|
+
```
|
71
|
+
|
72
|
+
## Hamlit
|
73
|
+
```html
|
74
|
+
<span class='foo foo bar'></span>
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
# [./spec/render/array_attribute_spec.rb:35](../../../spec/render/array_attribute_spec.rb#L35)
|
79
|
+
## Input
|
80
|
+
```haml
|
81
|
+
%span{class: []}
|
82
|
+
```
|
83
|
+
|
84
|
+
## Faml
|
85
|
+
```html
|
86
|
+
<span></span>
|
87
|
+
|
88
|
+
```
|
89
|
+
|
90
|
+
## Haml, Hamlit
|
91
|
+
```html
|
92
|
+
<span class=''></span>
|
93
|
+
|
94
|
+
```
|
95
|
+
|
96
|
+
# [./spec/render/array_attribute_spec.rb:35](../../../spec/render/array_attribute_spec.rb#L35)
|
97
|
+
## Input
|
98
|
+
```haml
|
99
|
+
- v = []
|
100
|
+
%span{class: v}
|
101
|
+
```
|
102
|
+
|
103
|
+
## Faml
|
104
|
+
```html
|
105
|
+
<span></span>
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
## Haml, Hamlit
|
110
|
+
```html
|
111
|
+
<span class=''></span>
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
# [./spec/render/array_attribute_spec.rb:35](../../../spec/render/array_attribute_spec.rb#L35)
|
116
|
+
## Input
|
117
|
+
```haml
|
118
|
+
- h = {class: []}
|
119
|
+
%span{h}
|
120
|
+
```
|
121
|
+
|
122
|
+
## Faml
|
123
|
+
```html
|
124
|
+
<span></span>
|
125
|
+
|
126
|
+
```
|
127
|
+
|
128
|
+
## Haml, Hamlit
|
129
|
+
```html
|
130
|
+
<span class=''></span>
|
131
|
+
|
132
|
+
```
|
133
|
+
|
134
|
+
# [./spec/render/array_attribute_spec.rb:41](../../../spec/render/array_attribute_spec.rb#L41)
|
135
|
+
## Input
|
136
|
+
```haml
|
137
|
+
%span{class: [1, nil, false, true]}
|
138
|
+
```
|
139
|
+
|
140
|
+
## Faml, Haml
|
141
|
+
```html
|
142
|
+
<span class='1 true'></span>
|
143
|
+
|
144
|
+
```
|
145
|
+
|
146
|
+
## Hamlit
|
147
|
+
```html
|
148
|
+
<span class='1 false true'></span>
|
149
|
+
|
150
|
+
```
|
151
|
+
|
152
|
+
# [./spec/render/array_attribute_spec.rb:41](../../../spec/render/array_attribute_spec.rb#L41)
|
153
|
+
## Input
|
154
|
+
```haml
|
155
|
+
- v = [1, nil, false, true]
|
156
|
+
%span{class: v}
|
157
|
+
```
|
158
|
+
|
159
|
+
## Faml, Haml
|
160
|
+
```html
|
161
|
+
<span class='1 true'></span>
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
## Hamlit
|
166
|
+
```html
|
167
|
+
<span class='1 false true'></span>
|
168
|
+
|
169
|
+
```
|
170
|
+
|
171
|
+
# [./spec/render/array_attribute_spec.rb:41](../../../spec/render/array_attribute_spec.rb#L41)
|
172
|
+
## Input
|
173
|
+
```haml
|
174
|
+
- h = {class: [1, nil, false, true]}
|
175
|
+
%span{h}
|
176
|
+
```
|
177
|
+
|
178
|
+
## Faml, Haml
|
179
|
+
```html
|
180
|
+
<span class='1 true'></span>
|
181
|
+
|
182
|
+
```
|
183
|
+
|
184
|
+
## Hamlit
|
185
|
+
```html
|
186
|
+
<span class='1 false true'></span>
|
187
|
+
|
188
|
+
```
|
189
|
+
|
190
|
+
# [./spec/render/array_attribute_spec.rb:61](../../../spec/render/array_attribute_spec.rb#L61)
|
191
|
+
## Input
|
192
|
+
```haml
|
193
|
+
%span{id: []}
|
194
|
+
```
|
195
|
+
|
196
|
+
## Faml
|
197
|
+
```html
|
198
|
+
<span></span>
|
199
|
+
|
200
|
+
```
|
201
|
+
|
202
|
+
## Haml, Hamlit
|
203
|
+
```html
|
204
|
+
<span id=''></span>
|
205
|
+
|
206
|
+
```
|
207
|
+
|
208
|
+
# [./spec/render/array_attribute_spec.rb:61](../../../spec/render/array_attribute_spec.rb#L61)
|
209
|
+
## Input
|
210
|
+
```haml
|
211
|
+
- v = []
|
212
|
+
%span{id: v}
|
213
|
+
```
|
214
|
+
|
215
|
+
## Faml
|
216
|
+
```html
|
217
|
+
<span></span>
|
218
|
+
|
219
|
+
```
|
220
|
+
|
221
|
+
## Haml, Hamlit
|
222
|
+
```html
|
223
|
+
<span id=''></span>
|
224
|
+
|
225
|
+
```
|
226
|
+
|
227
|
+
# [./spec/render/array_attribute_spec.rb:61](../../../spec/render/array_attribute_spec.rb#L61)
|
228
|
+
## Input
|
229
|
+
```haml
|
230
|
+
- h = {id: []}
|
231
|
+
%span{h}
|
232
|
+
```
|
233
|
+
|
234
|
+
## Faml
|
235
|
+
```html
|
236
|
+
<span></span>
|
237
|
+
|
238
|
+
```
|
239
|
+
|
240
|
+
## Haml, Hamlit
|
241
|
+
```html
|
242
|
+
<span id=''></span>
|
243
|
+
|
244
|
+
```
|
245
|
+
|
246
|
+
# [./spec/render/array_attribute_spec.rb:67](../../../spec/render/array_attribute_spec.rb#L67)
|
247
|
+
## Input
|
248
|
+
```haml
|
249
|
+
%span{id: [1, nil, false, true]}
|
250
|
+
```
|
251
|
+
|
252
|
+
## Faml, Haml
|
253
|
+
```html
|
254
|
+
<span id='1_true'></span>
|
255
|
+
|
256
|
+
```
|
257
|
+
|
258
|
+
## Hamlit
|
259
|
+
```html
|
260
|
+
<span id='1__false_true'></span>
|
261
|
+
|
262
|
+
```
|
263
|
+
|
264
|
+
# [./spec/render/array_attribute_spec.rb:67](../../../spec/render/array_attribute_spec.rb#L67)
|
265
|
+
## Input
|
266
|
+
```haml
|
267
|
+
- v = [1, nil, false, true]
|
268
|
+
%span{id: v}
|
269
|
+
```
|
270
|
+
|
271
|
+
## Faml, Haml
|
272
|
+
```html
|
273
|
+
<span id='1_true'></span>
|
274
|
+
|
275
|
+
```
|
276
|
+
|
277
|
+
## Hamlit
|
278
|
+
```html
|
279
|
+
<span id='1__false_true'></span>
|
280
|
+
|
281
|
+
```
|
282
|
+
|
283
|
+
# [./spec/render/array_attribute_spec.rb:67](../../../spec/render/array_attribute_spec.rb#L67)
|
284
|
+
## Input
|
285
|
+
```haml
|
286
|
+
- h = {id: [1, nil, false, true]}
|
287
|
+
%span{h}
|
288
|
+
```
|
289
|
+
|
290
|
+
## Faml, Haml
|
291
|
+
```html
|
292
|
+
<span id='1_true'></span>
|
293
|
+
|
294
|
+
```
|
295
|
+
|
296
|
+
## Hamlit
|
297
|
+
```html
|
298
|
+
<span id='1__false_true'></span>
|
299
|
+
|
300
|
+
```
|
301
|
+
|
@@ -1,423 +1,98 @@
|
|
1
|
-
# [./spec/render/attribute_spec.rb:
|
1
|
+
# [./spec/render/attribute_spec.rb:44](../../../spec/render/attribute_spec.rb#L44)
|
2
2
|
## Input
|
3
3
|
```haml
|
4
|
-
|
5
|
-
- h2 = {class: [{}, 'c2'], id: 'id2'}
|
6
|
-
%span#main.content{h1, h2} hello
|
7
|
-
|
8
|
-
```
|
9
|
-
|
10
|
-
## Faml, Haml
|
11
|
-
```html
|
12
|
-
<span class='c1 c2 content {}' id='main_id1_id3_id2'>hello</span>
|
13
|
-
|
14
|
-
```
|
15
|
-
|
16
|
-
## Hamlit
|
17
|
-
```html
|
18
|
-
<span class='c1 content c2 {}' id='main_id1_id3_id2'>hello</span>
|
19
|
-
|
20
|
-
```
|
21
|
-
|
22
|
-
# [./spec/render/attribute_spec.rb:62](../../../spec/render/attribute_spec.rb#L62)
|
23
|
-
## Input
|
24
|
-
```haml
|
25
|
-
%span.foo{class: "foo bar"}
|
26
|
-
```
|
27
|
-
|
28
|
-
## Faml, Haml
|
29
|
-
```html
|
30
|
-
<span class='bar foo'></span>
|
31
|
-
|
32
|
-
```
|
33
|
-
|
34
|
-
## Hamlit
|
35
|
-
```html
|
36
|
-
<span class='foo bar foo'></span>
|
37
|
-
|
38
|
-
```
|
39
|
-
|
40
|
-
# [./spec/render/attribute_spec.rb:62](../../../spec/render/attribute_spec.rb#L62)
|
41
|
-
## Input
|
42
|
-
```haml
|
43
|
-
- v = 'foo bar'
|
44
|
-
%span.foo{class: v}
|
45
|
-
```
|
46
|
-
|
47
|
-
## Faml, Haml
|
48
|
-
```html
|
49
|
-
<span class='bar foo'></span>
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
## Hamlit
|
54
|
-
```html
|
55
|
-
<span class='foo foo bar'></span>
|
56
|
-
|
57
|
-
```
|
58
|
-
|
59
|
-
# [./spec/render/attribute_spec.rb:62](../../../spec/render/attribute_spec.rb#L62)
|
60
|
-
## Input
|
61
|
-
```haml
|
62
|
-
- h = {class: 'foo bar'}
|
63
|
-
%span.foo{h}
|
64
|
-
```
|
65
|
-
|
66
|
-
## Faml, Haml
|
67
|
-
```html
|
68
|
-
<span class='bar foo'></span>
|
69
|
-
|
70
|
-
```
|
71
|
-
|
72
|
-
## Hamlit
|
73
|
-
```html
|
74
|
-
<span class='foo foo bar'></span>
|
75
|
-
|
76
|
-
```
|
77
|
-
|
78
|
-
# [./spec/render/attribute_spec.rb:80](../../../spec/render/attribute_spec.rb#L80)
|
79
|
-
## Input
|
80
|
-
```haml
|
81
|
-
%span{class: []}
|
82
|
-
```
|
83
|
-
|
84
|
-
## Faml
|
85
|
-
```html
|
86
|
-
<span></span>
|
87
|
-
|
88
|
-
```
|
89
|
-
|
90
|
-
## Haml, Hamlit
|
91
|
-
```html
|
92
|
-
<span class=''></span>
|
93
|
-
|
94
|
-
```
|
95
|
-
|
96
|
-
# [./spec/render/attribute_spec.rb:84](../../../spec/render/attribute_spec.rb#L84)
|
97
|
-
## Input
|
98
|
-
```haml
|
99
|
-
%span{class: [1, nil, false, true]}
|
100
|
-
```
|
101
|
-
|
102
|
-
## Faml, Haml
|
103
|
-
```html
|
104
|
-
<span class='1 true'></span>
|
105
|
-
|
106
|
-
```
|
107
|
-
|
108
|
-
## Hamlit
|
109
|
-
```html
|
110
|
-
<span class='1 false true'></span>
|
111
|
-
|
112
|
-
```
|
113
|
-
|
114
|
-
# [./spec/render/attribute_spec.rb:84](../../../spec/render/attribute_spec.rb#L84)
|
115
|
-
## Input
|
116
|
-
```haml
|
117
|
-
- v = [1, nil, false, true]
|
118
|
-
%span{class: v}
|
119
|
-
```
|
120
|
-
|
121
|
-
## Faml, Haml
|
122
|
-
```html
|
123
|
-
<span class='1 true'></span>
|
124
|
-
|
125
|
-
```
|
126
|
-
|
127
|
-
## Hamlit
|
128
|
-
```html
|
129
|
-
<span class='1 false true'></span>
|
130
|
-
|
131
|
-
```
|
132
|
-
|
133
|
-
# [./spec/render/attribute_spec.rb:84](../../../spec/render/attribute_spec.rb#L84)
|
134
|
-
## Input
|
135
|
-
```haml
|
136
|
-
- h = { class: [1, nil, false, true] }
|
137
|
-
%span{h}
|
138
|
-
```
|
139
|
-
|
140
|
-
## Faml, Haml
|
141
|
-
```html
|
142
|
-
<span class='1 true'></span>
|
143
|
-
|
144
|
-
```
|
145
|
-
|
146
|
-
## Hamlit
|
147
|
-
```html
|
148
|
-
<span class='1 false true'></span>
|
149
|
-
|
150
|
-
```
|
151
|
-
|
152
|
-
# [./spec/render/attribute_spec.rb:94](../../../spec/render/attribute_spec.rb#L94)
|
153
|
-
## Input
|
154
|
-
```haml
|
155
|
-
%span{id: []}
|
156
|
-
```
|
157
|
-
|
158
|
-
## Faml
|
159
|
-
```html
|
160
|
-
<span></span>
|
161
|
-
|
162
|
-
```
|
163
|
-
|
164
|
-
## Haml, Hamlit
|
165
|
-
```html
|
166
|
-
<span id=''></span>
|
167
|
-
|
168
|
-
```
|
169
|
-
|
170
|
-
# [./spec/render/attribute_spec.rb:98](../../../spec/render/attribute_spec.rb#L98)
|
171
|
-
## Input
|
172
|
-
```haml
|
173
|
-
%span{id: [1, nil, false, true]}
|
174
|
-
```
|
175
|
-
|
176
|
-
## Faml, Haml
|
177
|
-
```html
|
178
|
-
<span id='1_true'></span>
|
179
|
-
|
180
|
-
```
|
181
|
-
|
182
|
-
## Hamlit
|
183
|
-
```html
|
184
|
-
<span id='1__false_true'></span>
|
185
|
-
|
186
|
-
```
|
187
|
-
|
188
|
-
# [./spec/render/attribute_spec.rb:98](../../../spec/render/attribute_spec.rb#L98)
|
189
|
-
## Input
|
190
|
-
```haml
|
191
|
-
- v = [1, nil, false, true]
|
192
|
-
%span{id: v}
|
4
|
+
%span{foo: "x\"y'z"}hello
|
193
5
|
```
|
194
6
|
|
195
|
-
## Faml,
|
7
|
+
## Faml, Hamlit
|
196
8
|
```html
|
197
|
-
<span
|
9
|
+
<span foo='x"y'z'>hello</span>
|
198
10
|
|
199
11
|
```
|
200
12
|
|
201
|
-
##
|
13
|
+
## Haml
|
202
14
|
```html
|
203
|
-
<span
|
15
|
+
<span foo='x"y'z'>hello</span>
|
204
16
|
|
205
17
|
```
|
206
18
|
|
207
|
-
# [./spec/render/attribute_spec.rb:
|
19
|
+
# [./spec/render/attribute_spec.rb:44](../../../spec/render/attribute_spec.rb#L44)
|
208
20
|
## Input
|
209
21
|
```haml
|
210
|
-
-
|
211
|
-
%span{
|
22
|
+
- v = "x\"y'z"
|
23
|
+
%span{foo: v}hello
|
212
24
|
```
|
213
25
|
|
214
|
-
## Faml,
|
26
|
+
## Faml, Hamlit
|
215
27
|
```html
|
216
|
-
<span
|
28
|
+
<span foo='x"y'z'>hello</span>
|
217
29
|
|
218
30
|
```
|
219
31
|
|
220
|
-
##
|
32
|
+
## Haml
|
221
33
|
```html
|
222
|
-
<span
|
34
|
+
<span foo='x"y'z'>hello</span>
|
223
35
|
|
224
36
|
```
|
225
37
|
|
226
|
-
# [./spec/render/attribute_spec.rb:
|
38
|
+
# [./spec/render/attribute_spec.rb:44](../../../spec/render/attribute_spec.rb#L44)
|
227
39
|
## Input
|
228
40
|
```haml
|
229
|
-
|
41
|
+
- h = {foo: "x\"y'z"}
|
42
|
+
%span{h}hello
|
230
43
|
```
|
231
44
|
|
232
45
|
## Faml, Hamlit
|
233
46
|
```html
|
234
|
-
<span
|
47
|
+
<span foo='x"y'z'>hello</span>
|
235
48
|
|
236
49
|
```
|
237
50
|
|
238
51
|
## Haml
|
239
52
|
```html
|
240
|
-
<span
|
53
|
+
<span foo='x"y'z'>hello</span>
|
241
54
|
|
242
55
|
```
|
243
56
|
|
244
|
-
# [./spec/render/attribute_spec.rb:
|
57
|
+
# [./spec/render/attribute_spec.rb:61](../../../spec/render/attribute_spec.rb#L61)
|
245
58
|
## Input (with options={:format=>:xhtml})
|
246
59
|
```haml
|
247
|
-
-
|
248
|
-
%span{foo:
|
60
|
+
- v = true
|
61
|
+
%span{foo: v}hello
|
249
62
|
```
|
250
63
|
|
251
64
|
## Faml, Haml
|
252
65
|
```html
|
253
|
-
<span
|
66
|
+
<span foo='foo'>hello</span>
|
254
67
|
|
255
68
|
```
|
256
69
|
|
257
70
|
## Hamlit
|
258
71
|
```html
|
259
|
-
<span
|
72
|
+
<span foo='true'>hello</span>
|
260
73
|
|
261
74
|
```
|
262
75
|
|
263
|
-
# [./spec/render/attribute_spec.rb:
|
76
|
+
# [./spec/render/attribute_spec.rb:61](../../../spec/render/attribute_spec.rb#L61)
|
264
77
|
## Input (with options={:format=>:xhtml})
|
265
78
|
```haml
|
266
|
-
- h = {foo: true
|
267
|
-
%span{h}
|
268
|
-
```
|
269
|
-
|
270
|
-
## Faml, Haml
|
271
|
-
```html
|
272
|
-
<span bar='1' foo='foo'>hello</span>
|
273
|
-
|
274
|
-
```
|
275
|
-
|
276
|
-
## Hamlit
|
277
|
-
```html
|
278
|
-
<span foo bar='1'>hello</span>
|
279
|
-
|
280
|
-
```
|
281
|
-
|
282
|
-
# [./spec/render/attribute_spec.rb:129](../../../spec/render/attribute_spec.rb#L129)
|
283
|
-
## Input
|
284
|
-
```haml
|
285
|
-
%span{foo: {bar: 1+2}} hello
|
286
|
-
```
|
287
|
-
|
288
|
-
## Faml
|
289
|
-
```html
|
290
|
-
<span foo='{:bar=>3}'>hello</span>
|
291
|
-
|
292
|
-
```
|
293
|
-
|
294
|
-
## Haml, Hamlit
|
295
|
-
```html
|
296
|
-
<span foo-bar='3'>hello</span>
|
297
|
-
|
298
|
-
```
|
299
|
-
|
300
|
-
# [./spec/render/attribute_spec.rb:133](../../../spec/render/attribute_spec.rb#L133)
|
301
|
-
## Input
|
302
|
-
```haml
|
303
|
-
- attrs = { foo: 1, bar: { hoge: :fuga }, baz: true }
|
304
|
-
%span{attrs} hello
|
305
|
-
|
306
|
-
```
|
307
|
-
|
308
|
-
## Faml
|
309
|
-
```html
|
310
|
-
<span bar='{:hoge=>:fuga}' baz foo='1'>hello</span>
|
311
|
-
|
312
|
-
```
|
313
|
-
|
314
|
-
## Haml
|
315
|
-
```html
|
316
|
-
<span bar-hoge='fuga' baz foo='1'>hello</span>
|
317
|
-
|
318
|
-
```
|
319
|
-
|
320
|
-
## Hamlit
|
321
|
-
```html
|
322
|
-
<span foo='1' bar-hoge='fuga' baz>hello</span>
|
323
|
-
|
324
|
-
```
|
325
|
-
|
326
|
-
# [./spec/render/attribute_spec.rb:147](../../../spec/render/attribute_spec.rb#L147)
|
327
|
-
## Input
|
328
|
-
```haml
|
329
|
-
- data = { foo: 1 }
|
330
|
-
%span{foo: {bar: "x#{1}y"}} hello
|
331
|
-
|
332
|
-
```
|
333
|
-
|
334
|
-
## Faml
|
335
|
-
```html
|
336
|
-
<span foo='{:bar=>"x1y"}'>hello</span>
|
337
|
-
|
338
|
-
```
|
339
|
-
|
340
|
-
## Haml, Hamlit
|
341
|
-
```html
|
342
|
-
<span foo-bar='x1y'>hello</span>
|
343
|
-
|
344
|
-
```
|
345
|
-
|
346
|
-
# [./spec/render/attribute_spec.rb:161](../../../spec/render/attribute_spec.rb#L161)
|
347
|
-
## Input
|
348
|
-
```haml
|
349
|
-
%span{foo: {bar: 1+2}} hello
|
350
|
-
```
|
351
|
-
|
352
|
-
## Faml
|
353
|
-
```html
|
354
|
-
<span foo='{:bar=>3}'>hello</span>
|
355
|
-
|
356
|
-
```
|
357
|
-
|
358
|
-
## Haml, Hamlit
|
359
|
-
```html
|
360
|
-
<span foo-bar='3'>hello</span>
|
361
|
-
|
362
|
-
```
|
363
|
-
|
364
|
-
# [./spec/render/attribute_spec.rb:184](../../../spec/render/attribute_spec.rb#L184)
|
365
|
-
## Input
|
366
|
-
```haml
|
367
|
-
%span{data: {foo: 1, bar: 'baz', :hoge => :fuga, k1: { k2: 'v3' }}} hello
|
79
|
+
- h = {foo: true}
|
80
|
+
%span{h}hello
|
368
81
|
```
|
369
82
|
|
370
83
|
## Faml, Haml
|
371
84
|
```html
|
372
|
-
<span
|
85
|
+
<span foo='foo'>hello</span>
|
373
86
|
|
374
87
|
```
|
375
88
|
|
376
89
|
## Hamlit
|
377
90
|
```html
|
378
|
-
<span
|
91
|
+
<span foo>hello</span>
|
379
92
|
|
380
93
|
```
|
381
94
|
|
382
|
-
# [./spec/render/attribute_spec.rb:
|
383
|
-
## Input
|
384
|
-
```haml
|
385
|
-
%span{data: {foo: 1, bar: 2+3}} hello
|
386
|
-
```
|
387
|
-
|
388
|
-
## Faml, Haml
|
389
|
-
```html
|
390
|
-
<span data-bar='5' data-foo='1'>hello</span>
|
391
|
-
|
392
|
-
```
|
393
|
-
|
394
|
-
## Hamlit
|
395
|
-
```html
|
396
|
-
<span data-foo='1' data-bar='5'>hello</span>
|
397
|
-
|
398
|
-
```
|
399
|
-
|
400
|
-
# [./spec/render/attribute_spec.rb:196](../../../spec/render/attribute_spec.rb#L196)
|
401
|
-
## Input
|
402
|
-
```haml
|
403
|
-
- data = { foo: 1, bar: 2 }
|
404
|
-
%span{data: data} hello
|
405
|
-
|
406
|
-
```
|
407
|
-
|
408
|
-
## Faml, Haml
|
409
|
-
```html
|
410
|
-
<span data-bar='2' data-foo='1'>hello</span>
|
411
|
-
|
412
|
-
```
|
413
|
-
|
414
|
-
## Hamlit
|
415
|
-
```html
|
416
|
-
<span data-foo='1' data-bar='2'>hello</span>
|
417
|
-
|
418
|
-
```
|
419
|
-
|
420
|
-
# [./spec/render/attribute_spec.rb:214](../../../spec/render/attribute_spec.rb#L214)
|
95
|
+
# [./spec/render/attribute_spec.rb:75](../../../spec/render/attribute_spec.rb#L75)
|
421
96
|
## Input
|
422
97
|
```haml
|
423
98
|
%span{b: __LINE__,
|
@@ -437,7 +112,7 @@
|
|
437
112
|
|
438
113
|
```
|
439
114
|
|
440
|
-
# [./spec/render/attribute_spec.rb:
|
115
|
+
# [./spec/render/attribute_spec.rb:82](../../../spec/render/attribute_spec.rb#L82)
|
441
116
|
## Input
|
442
117
|
```haml
|
443
118
|
%span{"foo\0bar" => "hello"}
|
@@ -455,7 +130,7 @@
|
|
455
130
|
|
456
131
|
```
|
457
132
|
|
458
|
-
# [./spec/render/attribute_spec.rb:
|
133
|
+
# [./spec/render/attribute_spec.rb:82](../../../spec/render/attribute_spec.rb#L82)
|
459
134
|
## Input
|
460
135
|
```haml
|
461
136
|
- val = "hello"
|
@@ -475,7 +150,7 @@
|
|
475
150
|
|
476
151
|
```
|
477
152
|
|
478
|
-
# [./spec/render/attribute_spec.rb:
|
153
|
+
# [./spec/render/attribute_spec.rb:82](../../../spec/render/attribute_spec.rb#L82)
|
479
154
|
## Input
|
480
155
|
```haml
|
481
156
|
- key = "foo\0bar"
|
@@ -497,7 +172,7 @@
|
|
497
172
|
... ^
|
498
173
|
```
|
499
174
|
|
500
|
-
# [./spec/render/attribute_spec.rb:
|
175
|
+
# [./spec/render/attribute_spec.rb:96](../../../spec/render/attribute_spec.rb#L96)
|
501
176
|
## Input
|
502
177
|
```haml
|
503
178
|
%span[Faml::TestStruct.new(123)] hello
|
@@ -515,7 +190,7 @@
|
|
515
190
|
|
516
191
|
```
|
517
192
|
|
518
|
-
# [./spec/render/attribute_spec.rb:
|
193
|
+
# [./spec/render/attribute_spec.rb:100](../../../spec/render/attribute_spec.rb#L100)
|
519
194
|
## Input
|
520
195
|
```haml
|
521
196
|
%span[Faml::TestStruct.new(123), :hello] hello
|
@@ -533,7 +208,7 @@
|
|
533
208
|
|
534
209
|
```
|
535
210
|
|
536
|
-
# [./spec/render/attribute_spec.rb:
|
211
|
+
# [./spec/render/attribute_spec.rb:104](../../../spec/render/attribute_spec.rb#L104)
|
537
212
|
## Input
|
538
213
|
```haml
|
539
214
|
%span[Faml::TestRefStruct.new(123)] hello
|
@@ -551,7 +226,7 @@
|
|
551
226
|
|
552
227
|
```
|
553
228
|
|
554
|
-
# [./spec/render/attribute_spec.rb:
|
229
|
+
# [./spec/render/attribute_spec.rb:108](../../../spec/render/attribute_spec.rb#L108)
|
555
230
|
## Input
|
556
231
|
```haml
|
557
232
|
%span#baz[Faml::TestStruct.new(123)]{id: "foo"} hello
|
@@ -569,7 +244,7 @@
|
|
569
244
|
|
570
245
|
```
|
571
246
|
|
572
|
-
# [./spec/render/attribute_spec.rb:
|
247
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
573
248
|
## Input
|
574
249
|
```haml
|
575
250
|
%span{foo: 1}(foo=2)
|
@@ -587,7 +262,7 @@
|
|
587
262
|
|
588
263
|
```
|
589
264
|
|
590
|
-
# [./spec/render/attribute_spec.rb:
|
265
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
591
266
|
## Input
|
592
267
|
```haml
|
593
268
|
%span(foo=2){foo: 1}
|
@@ -605,7 +280,7 @@
|
|
605
280
|
|
606
281
|
```
|
607
282
|
|
608
|
-
# [./spec/render/attribute_spec.rb:
|
283
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
609
284
|
## Input
|
610
285
|
```haml
|
611
286
|
- v = 2
|
@@ -624,7 +299,7 @@
|
|
624
299
|
|
625
300
|
```
|
626
301
|
|
627
|
-
# [./spec/render/attribute_spec.rb:
|
302
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
628
303
|
## Input
|
629
304
|
```haml
|
630
305
|
- v = 2
|
@@ -643,7 +318,7 @@
|
|
643
318
|
|
644
319
|
```
|
645
320
|
|
646
|
-
# [./spec/render/attribute_spec.rb:
|
321
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
647
322
|
## Input
|
648
323
|
```haml
|
649
324
|
- h = {foo: 1}
|
@@ -662,7 +337,7 @@
|
|
662
337
|
|
663
338
|
```
|
664
339
|
|
665
|
-
# [./spec/render/attribute_spec.rb:
|
340
|
+
# [./spec/render/attribute_spec.rb:114](../../../spec/render/attribute_spec.rb#L114)
|
666
341
|
## Input
|
667
342
|
```haml
|
668
343
|
- h = {foo: 1}
|
@@ -681,7 +356,7 @@
|
|
681
356
|
|
682
357
|
```
|
683
358
|
|
684
|
-
# [./spec/render/attribute_spec.rb:
|
359
|
+
# [./spec/render/attribute_spec.rb:133](../../../spec/render/attribute_spec.rb#L133)
|
685
360
|
## Input
|
686
361
|
```haml
|
687
362
|
%span{id: 1}(id=2)
|