hamlit 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41181b03fb2da5795efd910df32b4af7dec36c76
4
- data.tar.gz: 5c87563fb9b05df21292a6fef7893d776030a422
3
+ metadata.gz: 89d7cfad07da030166e5964134abf59d18e44865
4
+ data.tar.gz: 441d90d73df696acc1348d3f8ce755d43aa30c1c
5
5
  SHA512:
6
- metadata.gz: 9179fb592fc4469d868ce8c13d44559db430cc3485c1774283006f36664dd6ed91f196fa6b7860cc0d810efaab353b30b97a1c85be85f8fd8e86c2b0ced0d624
7
- data.tar.gz: 80f76409f03008b7a0bb951f26c9edaf2a5c9071b031ce47d12de288672cebf766c0da3787121a55d805d13eb66543a7bf532ba81ca382219c8493a6968cb272
6
+ metadata.gz: f87e5a80a46d4b9d092c6788d5debb783281cb59bc4c50b43141ebc7bf0041835b4097784819023c207b013665aced148855c16d71b0c450eccb037ac7e22c07
7
+ data.tar.gz: d493776d47975894589784a773c1f003b10227b20a3e2e086ce55431fa1b016d5f1290d0218fc5ec7c6241fe8a4501a18e010a6c0a6c7d7ade8d2c5d66911a41
@@ -0,0 +1,73 @@
1
+ ## v0.4.2
2
+
3
+ - Bugfix about parsing nested attributes
4
+ - https://github.com/k0kubun/hamlit/issues/12
5
+ - Thanks to @creasty
6
+
7
+ ## v0.4.1
8
+
9
+ - Escape haml operators by backslash
10
+ - https://github.com/k0kubun/hamlit/issues/11
11
+ - Thanks to @mono0x
12
+
13
+ ## v0.4.0 (yanked)
14
+
15
+ - Automatically escape html in sinatra
16
+ - This behavior is not compatible with Haml.
17
+ - Removed from next version.
18
+
19
+ ## v0.3.4
20
+
21
+ - Allow tab indentation.
22
+ - https://github.com/k0kubun/hamlit/issues/9
23
+ - Thanks to @tdtds
24
+
25
+ ## v0.3.3
26
+
27
+ - Accept multi byte parsing.
28
+ - https://github.com/k0kubun/hamlit/issues/8
29
+ - Thanks to @machu
30
+
31
+ ## v0.3.2
32
+
33
+ - Bugfix for compiling old attributes.
34
+ - https://github.com/k0kubun/hamlit/issues/7
35
+ - Thanks to @creasty
36
+
37
+ ## v0.3.1
38
+
39
+ - Hyphenate data attributes.
40
+ - https://github.com/k0kubun/hamlit/issues/5
41
+ - Thanks to @os0x
42
+
43
+ ## v0.3.0
44
+
45
+ - Specify a version in dependency of temple.
46
+
47
+ ## v0.2.0
48
+
49
+ - Allow comments in script.
50
+ - https://github.com/k0kubun/hamlit/issues/3
51
+ - Thanks to @eagletmt
52
+
53
+ ## v0.1.3
54
+
55
+ - Bugfix for attribute nesting on runtime.
56
+ - https://github.com/k0kubun/hamlit/issues/1
57
+ - Thanks to @eagletmt
58
+
59
+ ## v0.1.2
60
+
61
+ - Ignore false or nil values in attributes
62
+ - Partial fix for https://github.com/k0kubun/hamlit/issues/2
63
+ - Thanks to @eagletmt
64
+
65
+ ## v0.1.1
66
+
67
+ - Drop obsolete `--ugly` option for CLI.
68
+ - Currently pretty mode is not implemented.
69
+
70
+ ## v0.1.0
71
+
72
+ - Initial release.
73
+ - Passing haml-spec with ugly mode.
@@ -140,12 +140,16 @@ module Hamlit
140
140
  end
141
141
 
142
142
  def reject_nested_columns(str, columns)
143
- result = []
143
+ result = []
144
144
  open_count = 0
145
- emb_count = 0
145
+ count = {
146
+ emb: 0,
147
+ paren: 0,
148
+ bracket: 0,
149
+ }
146
150
 
147
151
  Ripper.lex(str).each do |(row, col), type, str|
148
- if columns.include?(col) && open_count == 1 && emb_count == 0
152
+ if columns.include?(col) && open_count == 1 && count.values.all?(&:zero?)
149
153
  result << col
150
154
  end
151
155
 
@@ -155,9 +159,17 @@ module Hamlit
155
159
  when :on_rbrace
156
160
  open_count -= 1
157
161
  when :on_embexpr_beg
158
- emb_count += 1
162
+ count[:emb] += 1
159
163
  when :on_embexpr_end
160
- emb_count -= 1
164
+ count[:emb] -= 1
165
+ when :on_lparen
166
+ count[:paren] += 1
167
+ when :on_rparen
168
+ count[:paren] -= 1
169
+ when :on_lbracket
170
+ count[:bracket] += 1
171
+ when :on_rbracket
172
+ count[:bracket] -= 1
161
173
  end
162
174
  end
163
175
  result
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -1,3 +1,5 @@
1
1
  %a{ value: "#{I18n.t "foo", count: 1}" }
2
2
  %span{ data: { value: "#{I18n.t "foo", count: 2}" } }
3
3
  .foo{ data: { value: "#{I18n.t "foo", count: 3}"}}
4
+ %a{ data: { value: t('foo', count: 4) } }
5
+ %a{ data: { value: [count: 1] } }
@@ -29,6 +29,8 @@ describe 'Hamlit rails integration', type: :request do
29
29
  expect(response.body).to include("<a value='foo 1'></a>")
30
30
  expect(response.body).to include("<span data-value='foo 2'></span>")
31
31
  expect(response.body).to include("<div class='foo' data-value='foo 3'></div>")
32
+ expect(response.body).to include("<a data-value='foo 4'></a>")
33
+ expect(response.body).to include("<a data-value='[{:count=>1}]'></a>")
32
34
  end
33
35
 
34
36
  describe 'escaping' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -287,6 +287,7 @@ files:
287
287
  - ".gitignore"
288
288
  - ".rspec"
289
289
  - ".travis.yml"
290
+ - CHANGELOG.md
290
291
  - Gemfile
291
292
  - LICENSE.txt
292
293
  - README.md