hamlit 1.5.7 → 1.5.8

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: bd08607e661773fdb5b3615f58c436b3efceea82
4
- data.tar.gz: 935a17fc15a78de1d6ca821104fa8d3f74f1b54c
3
+ metadata.gz: 3292ded147aeb720738b722d3ae053e58b50ba1d
4
+ data.tar.gz: ccc5a8f8dd78f16325c7da108946125f927708df
5
5
  SHA512:
6
- metadata.gz: ca7571512c56d3ff44304efd1c30135344aed980dfb26395d23006068f76c35ae29ae19bc4533ec3644712a39bd03ad5b088735f325f9a01745f3808e40152e2
7
- data.tar.gz: 26145af5ca66444899ac3498c460e1695a6ee280f802fc794664edac648f5bc8afd242d16ca3e40c95bb56d76128b351e23dc43d7a4c5c3bde805108aee5157c
6
+ metadata.gz: e5e7fc75dd1d78f68283c6f2bc0f48107284320528ecd087e20dc3e2d2ec5c2c3942642818cb3e477b18c76f455a08bc12668b44a70ea36943df216af83c23aa
7
+ data.tar.gz: 914adab630716407fc272b775f19af94e2245f3cba68881c9abe363ed2c7813ba3388917331c8a4b93dd825d3f5442364c46961871009455294e9ab05fea0d19
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v1.5.8
2
+
3
+ - Fix parsing inline script for != and &=
4
+
1
5
  ## v1.5.7
2
6
 
3
7
  - Fix the behavior for multi-line script
@@ -25,9 +25,7 @@ module Hamlit
25
25
  ast = [:html, :tag, tag, attrs]
26
26
  inner_removal = parse_whitespace_removal(scanner)
27
27
 
28
- if scanner.match?(/=/)
29
- return ast << parse_script(scanner)
30
- elsif !has_block?
28
+ if !has_block? || scanner.match?(/=|&=|!=/)
31
29
  return ast if scanner.scan(/\//)
32
30
  return ast << parse_line(scanner, inline: true)
33
31
  end
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "1.5.7"
2
+ VERSION = "1.5.8"
3
3
  end
@@ -0,0 +1,6 @@
1
+ %span= link_to '1', '#',
2
+ data: { url: '2' }
3
+ %span!= link_to '3', '#',
4
+ data: { url: '4' }
5
+ %span&= link_to '5', '#',
6
+ data: { url: '6' }
@@ -10,6 +10,7 @@ Rails.application.routes.draw do
10
10
  get :safe_buffer
11
11
  get :old_attributes
12
12
  get :whitespace
13
+ get :inline
13
14
  end
14
15
  end
15
16
  end
@@ -33,6 +33,14 @@ describe 'Hamlit rails integration', type: :request do
33
33
  expect(response.body).to include("<a data-value='[{:count=&gt;1}]'></a>")
34
34
  end
35
35
 
36
+ it 'renders multi-line script inside a tag' do
37
+ get inline_users_path
38
+ expect(response.body).to include('<span><a data-url="2" href="#">1</a></span>')
39
+ expect(response.body).to include('<span><a data-url="4" href="#">3</a></span>')
40
+ expect(response.body).to include('<span><a data-url="6" href="#">5</a></span>')
41
+ expect(response.body).to include('<span><a data-url="6" href="#">5</a></span>')
42
+ end
43
+
36
44
  describe 'escaping' do
37
45
  it 'escapes script' do
38
46
  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: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -413,6 +413,7 @@ files:
413
413
  - spec/rails/app/views/users/form.html.haml
414
414
  - spec/rails/app/views/users/helpers.html.haml
415
415
  - spec/rails/app/views/users/index.html.haml
416
+ - spec/rails/app/views/users/inline.html.haml
416
417
  - spec/rails/app/views/users/old_attributes.html.haml
417
418
  - spec/rails/app/views/users/safe_buffer.html.haml
418
419
  - spec/rails/app/views/users/whitespace.html.haml
@@ -528,6 +529,7 @@ test_files:
528
529
  - spec/rails/app/views/users/form.html.haml
529
530
  - spec/rails/app/views/users/helpers.html.haml
530
531
  - spec/rails/app/views/users/index.html.haml
532
+ - spec/rails/app/views/users/inline.html.haml
531
533
  - spec/rails/app/views/users/old_attributes.html.haml
532
534
  - spec/rails/app/views/users/safe_buffer.html.haml
533
535
  - spec/rails/app/views/users/whitespace.html.haml
@@ -571,3 +573,4 @@ test_files:
571
573
  - spec/rails/vendor/assets/javascripts/.keep
572
574
  - spec/rails/vendor/assets/stylesheets/.keep
573
575
  - spec/spec_helper.rb
576
+ has_rdoc: