hamlit 0.3.1 → 0.3.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: 4ddd725e168d26ee17fdcfeeff3988fc46d1a3f2
4
- data.tar.gz: 7007913e4c3109c688529e9cecf93ae5a5ac1a72
3
+ metadata.gz: d2a83cb9f5876957f819ff865a43be7ce1eb7c22
4
+ data.tar.gz: 482c96d3f4d086cfd8b730cde51ea00b9f07149a
5
5
  SHA512:
6
- metadata.gz: c540899eece79a297d71d6d369d4aa65db1e9f145872ec1767778ae8ba55368d129cbed4f1a639163bd9904717dc36662ba368ad57f56c97af52edb02345dcac
7
- data.tar.gz: 688cba8235f8978e30d98f731f711c1da70f554389ee1ec2dffab6f999d521c335229878bc37a40957558685fa637d5f0b5fd13cc78c5f65ed9242cf78f9a2b0
6
+ metadata.gz: 3b84f182a19e5625d68b3731e7720978464232e9e6034806c156c3ef35b3a66840722615e311e9c16ef0b26bfb24efe84e35c375323e81889d866a0b5d93bae9
7
+ data.tar.gz: fbe95e02dfed0e1c7f54341aaad968811fefd9cedc7c295cc20a7643a4f2cd22ddbc993e4a2cfbecd0a3f58653bf9e485fc02d1ba96442dfce88adbad0c7e15f
@@ -138,9 +138,10 @@ module Hamlit
138
138
  def reject_nested_columns(str, columns)
139
139
  result = []
140
140
  open_count = 0
141
+ emb_count = 0
141
142
 
142
143
  Ripper.lex(str).each do |(row, col), type, str|
143
- if columns.include?(col) && open_count == 1
144
+ if columns.include?(col) && open_count == 1 && emb_count == 0
144
145
  result << col
145
146
  end
146
147
 
@@ -149,6 +150,10 @@ module Hamlit
149
150
  open_count += 1
150
151
  when :on_rbrace
151
152
  open_count -= 1
153
+ when :on_embexpr_beg
154
+ emb_count += 1
155
+ when :on_embexpr_end
156
+ emb_count -= 1
152
157
  end
153
158
  end
154
159
  result
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -17,4 +17,7 @@ class UsersController < ApplicationController
17
17
 
18
18
  def safe_buffer
19
19
  end
20
+
21
+ def old_attributes
22
+ end
20
23
  end
@@ -0,0 +1,3 @@
1
+ %a{ value: "#{I18n.t "foo", count: 1}" }
2
+ %span{ data: { value: "#{I18n.t "foo", count: 2}" } }
3
+ .foo{ data: { value: "#{I18n.t "foo", count: 3}"}}
@@ -21,3 +21,4 @@
21
21
 
22
22
  en:
23
23
  hello: "Hello world"
24
+ foo: "foo %{count}"
@@ -8,6 +8,7 @@ Rails.application.routes.draw do
8
8
  get :form
9
9
  get :helpers
10
10
  get :safe_buffer
11
+ get :old_attributes
11
12
  end
12
13
  end
13
14
  end
@@ -24,6 +24,13 @@ describe 'Hamlit rails integration', type: :request do
24
24
  expect(response.body).to include('<safe>')
25
25
  end
26
26
 
27
+ it 'renders a complex old attributes' do
28
+ get old_attributes_users_path
29
+ expect(response.body).to include("<a value='foo 1'></a>")
30
+ expect(response.body).to include("<span data-value='foo 2'></span>")
31
+ expect(response.body).to include("<div class='foo' data-value='foo 3'></div>")
32
+ end
33
+
27
34
  describe 'escaping' do
28
35
  it 'escapes script' do
29
36
  get users_path(q: '<script>alert("a");</script>')
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -402,6 +402,7 @@ files:
402
402
  - spec/rails/app/views/users/form.html.haml
403
403
  - spec/rails/app/views/users/helpers.html.haml
404
404
  - spec/rails/app/views/users/index.html.haml
405
+ - spec/rails/app/views/users/old_attributes.html.haml
405
406
  - spec/rails/app/views/users/safe_buffer.html.haml
406
407
  - spec/rails/bin/bundle
407
408
  - spec/rails/bin/rails
@@ -514,6 +515,7 @@ test_files:
514
515
  - spec/rails/app/views/users/form.html.haml
515
516
  - spec/rails/app/views/users/helpers.html.haml
516
517
  - spec/rails/app/views/users/index.html.haml
518
+ - spec/rails/app/views/users/old_attributes.html.haml
517
519
  - spec/rails/app/views/users/safe_buffer.html.haml
518
520
  - spec/rails/bin/bundle
519
521
  - spec/rails/bin/rails