faml 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/attribute_builder/attribute_builder.c +1 -1
- data/incompatibilities/README.md +1 -1
- data/incompatibilities/spec/render/attribute_spec.md +23 -23
- data/lib/faml/version.rb +1 -1
- data/spec/render/attribute_spec.rb +5 -0
- data/spec/spec_helper.rb +3 -2
- data/spec/support/incompatibilities_generator.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71da312b9097d26800c2431adb5d01cc26252276
|
4
|
+
data.tar.gz: acae87261e0f0650f0df3130eb8f97ba8326ae44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cbeb2dd1d2e326cb4540c30a50bc12440d760b2e618374aab624170585d0d8f7765ff07eb5781798f7341ce8e3fd44f13032e9f1f9e6250d45e3ace026f7b8
|
7
|
+
data.tar.gz: 97ca3e26cd3493865f8300c2fa8b701ea854258849ac8eb99b90c493fdf9b5160ffd0e55d3d7e9cc5fb37120d42b3afe4063b34df7701a2de1474be41606a206
|
data/CHANGELOG.md
CHANGED
@@ -187,7 +187,7 @@ put_attribute(VALUE buf, VALUE attr_quote, VALUE key, VALUE value)
|
|
187
187
|
gh_buf ob = GH_BUF_INIT;
|
188
188
|
|
189
189
|
Check_Type(value, T_STRING);
|
190
|
-
if (
|
190
|
+
if (houdini_escape_html0(&ob, (const uint8_t *)RSTRING_PTR(value), RSTRING_LEN(value), 0)) {
|
191
191
|
value = rb_enc_str_new(ob.ptr, ob.size, rb_utf8_encoding());
|
192
192
|
gh_buf_free(&ob);
|
193
193
|
}
|
data/incompatibilities/README.md
CHANGED
@@ -58,8 +58,7 @@
|
|
58
58
|
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
|
59
59
|
## Input
|
60
60
|
```haml
|
61
|
-
|
62
|
-
%span{class: v}
|
61
|
+
%span{class: [1, nil, false, true]}
|
63
62
|
```
|
64
63
|
|
65
64
|
## Faml, Haml
|
@@ -77,8 +76,8 @@
|
|
77
76
|
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
|
78
77
|
## Input
|
79
78
|
```haml
|
80
|
-
-
|
81
|
-
%span{
|
79
|
+
- v = [1, nil, false, true]
|
80
|
+
%span{class: v}
|
82
81
|
```
|
83
82
|
|
84
83
|
## Faml, Haml
|
@@ -96,7 +95,8 @@
|
|
96
95
|
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
|
97
96
|
## Input
|
98
97
|
```haml
|
99
|
-
|
98
|
+
- h = { class: [1, nil, false, true] }
|
99
|
+
%span{h}
|
100
100
|
```
|
101
101
|
|
102
102
|
## Faml, Haml
|
@@ -132,8 +132,7 @@
|
|
132
132
|
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
|
133
133
|
## Input
|
134
134
|
```haml
|
135
|
-
|
136
|
-
%span{id: v}
|
135
|
+
%span{id: [1, nil, false, true]}
|
137
136
|
```
|
138
137
|
|
139
138
|
## Faml, Haml
|
@@ -151,8 +150,8 @@
|
|
151
150
|
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
|
152
151
|
## Input
|
153
152
|
```haml
|
154
|
-
-
|
155
|
-
%span{
|
153
|
+
- v = [1, nil, false, true]
|
154
|
+
%span{id: v}
|
156
155
|
```
|
157
156
|
|
158
157
|
## Faml, Haml
|
@@ -170,7 +169,8 @@
|
|
170
169
|
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
|
171
170
|
## Input
|
172
171
|
```haml
|
173
|
-
|
172
|
+
- h = { id: [1, nil, false, true] }
|
173
|
+
%span{h}
|
174
174
|
```
|
175
175
|
|
176
176
|
## Faml, Haml
|
@@ -203,7 +203,7 @@
|
|
203
203
|
|
204
204
|
```
|
205
205
|
|
206
|
-
# [./spec/render/attribute_spec.rb:
|
206
|
+
# [./spec/render/attribute_spec.rb:109](../../../spec/render/attribute_spec.rb#L109)
|
207
207
|
## Input (with options={:format=>:xhtml})
|
208
208
|
```haml
|
209
209
|
- foo = true
|
@@ -222,7 +222,7 @@
|
|
222
222
|
|
223
223
|
```
|
224
224
|
|
225
|
-
# [./spec/render/attribute_spec.rb:
|
225
|
+
# [./spec/render/attribute_spec.rb:109](../../../spec/render/attribute_spec.rb#L109)
|
226
226
|
## Input (with options={:format=>:xhtml})
|
227
227
|
```haml
|
228
228
|
- h = {foo: true, bar: 1}
|
@@ -241,7 +241,7 @@
|
|
241
241
|
|
242
242
|
```
|
243
243
|
|
244
|
-
# [./spec/render/attribute_spec.rb:
|
244
|
+
# [./spec/render/attribute_spec.rb:116](../../../spec/render/attribute_spec.rb#L116)
|
245
245
|
## Input
|
246
246
|
```haml
|
247
247
|
%span{foo: {bar: 1+2}} hello
|
@@ -259,7 +259,7 @@
|
|
259
259
|
|
260
260
|
```
|
261
261
|
|
262
|
-
# [./spec/render/attribute_spec.rb:
|
262
|
+
# [./spec/render/attribute_spec.rb:120](../../../spec/render/attribute_spec.rb#L120)
|
263
263
|
## Input
|
264
264
|
```haml
|
265
265
|
- attrs = { foo: 1, bar: { hoge: :fuga }, baz: true }
|
@@ -285,7 +285,7 @@
|
|
285
285
|
|
286
286
|
```
|
287
287
|
|
288
|
-
# [./spec/render/attribute_spec.rb:
|
288
|
+
# [./spec/render/attribute_spec.rb:134](../../../spec/render/attribute_spec.rb#L134)
|
289
289
|
## Input
|
290
290
|
```haml
|
291
291
|
- data = { foo: 1 }
|
@@ -305,7 +305,7 @@
|
|
305
305
|
|
306
306
|
```
|
307
307
|
|
308
|
-
# [./spec/render/attribute_spec.rb:
|
308
|
+
# [./spec/render/attribute_spec.rb:141](../../../spec/render/attribute_spec.rb#L141)
|
309
309
|
## Input
|
310
310
|
```haml
|
311
311
|
%span{foo: {bar: 1+2}} hello
|
@@ -323,7 +323,7 @@
|
|
323
323
|
|
324
324
|
```
|
325
325
|
|
326
|
-
# [./spec/render/attribute_spec.rb:
|
326
|
+
# [./spec/render/attribute_spec.rb:164](../../../spec/render/attribute_spec.rb#L164)
|
327
327
|
## Input
|
328
328
|
```haml
|
329
329
|
%span{data: {foo: 1, bar: 'baz', :hoge => :fuga, k1: { k2: 'v3' }}} hello
|
@@ -341,7 +341,7 @@
|
|
341
341
|
|
342
342
|
```
|
343
343
|
|
344
|
-
# [./spec/render/attribute_spec.rb:
|
344
|
+
# [./spec/render/attribute_spec.rb:172](../../../spec/render/attribute_spec.rb#L172)
|
345
345
|
## Input
|
346
346
|
```haml
|
347
347
|
%span{data: {foo: 1, bar: 2+3}} hello
|
@@ -359,7 +359,7 @@
|
|
359
359
|
|
360
360
|
```
|
361
361
|
|
362
|
-
# [./spec/render/attribute_spec.rb:
|
362
|
+
# [./spec/render/attribute_spec.rb:176](../../../spec/render/attribute_spec.rb#L176)
|
363
363
|
## Input
|
364
364
|
```haml
|
365
365
|
- data = { foo: 1, bar: 2 }
|
@@ -379,7 +379,7 @@
|
|
379
379
|
|
380
380
|
```
|
381
381
|
|
382
|
-
# [./spec/render/attribute_spec.rb:
|
382
|
+
# [./spec/render/attribute_spec.rb:194](../../../spec/render/attribute_spec.rb#L194)
|
383
383
|
## Input
|
384
384
|
```haml
|
385
385
|
%span{b: __LINE__,
|
@@ -399,7 +399,7 @@
|
|
399
399
|
|
400
400
|
```
|
401
401
|
|
402
|
-
# [./spec/render/attribute_spec.rb:
|
402
|
+
# [./spec/render/attribute_spec.rb:201](../../../spec/render/attribute_spec.rb#L201)
|
403
403
|
## Input
|
404
404
|
```haml
|
405
405
|
%span{"foo\0bar" => "hello"}
|
@@ -417,7 +417,7 @@
|
|
417
417
|
|
418
418
|
```
|
419
419
|
|
420
|
-
# [./spec/render/attribute_spec.rb:
|
420
|
+
# [./spec/render/attribute_spec.rb:201](../../../spec/render/attribute_spec.rb#L201)
|
421
421
|
## Input
|
422
422
|
```haml
|
423
423
|
- val = "hello"
|
@@ -437,7 +437,7 @@
|
|
437
437
|
|
438
438
|
```
|
439
439
|
|
440
|
-
# [./spec/render/attribute_spec.rb:
|
440
|
+
# [./spec/render/attribute_spec.rb:201](../../../spec/render/attribute_spec.rb#L201)
|
441
441
|
## Input
|
442
442
|
```haml
|
443
443
|
- key = "foo\0bar"
|
data/lib/faml/version.rb
CHANGED
@@ -92,6 +92,11 @@ HAML
|
|
92
92
|
expect(render_string(%q|%span{class: "x\"y'z"} hello|)).to eq(%Q{<span class='x"y'z'>hello</span>\n})
|
93
93
|
end
|
94
94
|
|
95
|
+
it 'does not escape slash' do
|
96
|
+
expect(render_string(%q|%a{ href: 'http://example.com/' }|)).to eq(%Q{<a href='http://example.com/'></a>\n})
|
97
|
+
expect(render_string(%q|%a{ {}, href: 'http://example.com/' }|)).to eq(%Q{<a href='http://example.com/'></a>\n})
|
98
|
+
end
|
99
|
+
|
95
100
|
it 'renders only name if value is true' do
|
96
101
|
expect(render_string(%q|%span{foo: true, bar: 1} hello|)).to eq(%Q{<span bar='1' foo>hello</span>\n})
|
97
102
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,11 +16,12 @@ module RenderSpecHelper
|
|
16
16
|
require_relative 'support/incompatibilities_generator'
|
17
17
|
|
18
18
|
def render_string(str, options = {})
|
19
|
+
loc = caller_locations(1..1)[0]
|
19
20
|
eval(Faml::Engine.new(options).call(str)).tap do |html|
|
20
|
-
IncompatibilitiesGenerator.instance.record(str, options, html, RSpec.current_example)
|
21
|
+
IncompatibilitiesGenerator.instance.record(str, options, html, RSpec.current_example, loc.lineno)
|
21
22
|
end
|
22
23
|
rescue => e
|
23
|
-
IncompatibilitiesGenerator.instance.record(str, options, e, RSpec.current_example)
|
24
|
+
IncompatibilitiesGenerator.instance.record(str, options, e, RSpec.current_example, loc.lineno)
|
24
25
|
raise e
|
25
26
|
end
|
26
27
|
else
|
@@ -6,7 +6,7 @@ require 'hamlit/version'
|
|
6
6
|
class IncompatibilitiesGenerator
|
7
7
|
include Singleton
|
8
8
|
|
9
|
-
Record = Struct.new(:template, :options, :spec_path, :line_number, :faml_result, :haml_result, :hamlit_result) do
|
9
|
+
Record = Struct.new(:template, :options, :spec_path, :line_number, :caller_lineno, :faml_result, :haml_result, :hamlit_result) do
|
10
10
|
def incompatible?
|
11
11
|
!all_error? && (faml_result != haml_result || faml_result != hamlit_result || haml_result != hamlit_result)
|
12
12
|
end
|
@@ -39,9 +39,9 @@ class IncompatibilitiesGenerator
|
|
39
39
|
@records = []
|
40
40
|
end
|
41
41
|
|
42
|
-
def record(template, options, faml_result, example)
|
42
|
+
def record(template, options, faml_result, example, caller_lineno)
|
43
43
|
m = example.location.match(/\A(.+):(\d+)\z/)
|
44
|
-
@records.push(Record.new(template, options, m[1], m[2].to_i, faml_result, render_haml(template, options), render_hamlit(template, options)))
|
44
|
+
@records.push(Record.new(template, options, m[1], m[2].to_i, caller_lineno, faml_result, render_haml(template, options), render_hamlit(template, options)))
|
45
45
|
end
|
46
46
|
|
47
47
|
def write_to(markdown_root)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
511
|
version: '0'
|
512
512
|
requirements: []
|
513
513
|
rubyforge_project:
|
514
|
-
rubygems_version: 2.
|
514
|
+
rubygems_version: 2.5.0
|
515
515
|
signing_key:
|
516
516
|
specification_version: 4
|
517
517
|
summary: Faster implementation of Haml template language.
|