hamlit 0.3.1 → 0.3.2
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/lib/hamlit/compilers/old_attribute.rb +6 -1
- data/lib/hamlit/version.rb +1 -1
- data/spec/rails/app/controllers/users_controller.rb +3 -0
- data/spec/rails/app/views/users/old_attributes.html.haml +3 -0
- data/spec/rails/config/locales/en.yml +1 -0
- data/spec/rails/config/routes.rb +1 -0
- data/spec/rails/spec/hamlit_spec.rb +7 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2a83cb9f5876957f819ff865a43be7ce1eb7c22
|
4
|
+
data.tar.gz: 482c96d3f4d086cfd8b730cde51ea00b9f07149a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/hamlit/version.rb
CHANGED
data/spec/rails/config/routes.rb
CHANGED
@@ -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.
|
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
|