slimi 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
  SHA256:
3
- metadata.gz: 299f0ea50391c15aed1b99b4fb2cb1a8eae63a3ba97e2abc31cf676472a38cd8
4
- data.tar.gz: 6119285d8a753ab001bf29eff8df574dfab52636fc092d324db50ec7d094e7eb
3
+ metadata.gz: a503c590465e63f43b6d9ef8047700ff415bfea923df65be323f2d37f5d94b71
4
+ data.tar.gz: 4ad486738d38c81b670cb693afa31c9c7f8acb92ab05a844d47cf3df1d0219c8
5
5
  SHA512:
6
- metadata.gz: 9269ec0c3c35efd6665a3f7aff882737479b72998b28cc067a80823885316a267958f3bf2a62107c7d56fd31bb12675f17b77053f7372c40fe768e3865775c13
7
- data.tar.gz: 7c03ac659b980eb512c87c0fa8a3bc2b991faac079f71426e67a3ede722455677b3647d7ceb8af286aae3a38730b4e42c40ac07a62662c2db7d34339060a6055
6
+ metadata.gz: '08dc1c84baa6a338564757e6c28143a77f1ecc03eb4ba7f72bf2af82ce673eb2c573debbbbf5eaf16673b53e07a49dd3493888875e6b9e5016557ab7f8373368'
7
+ data.tar.gz: dd3bb74308363284ff648f80d2dcc37fe9b7faa75df2b31210ca4567fa088debca11b5831bb8ec745800bd15e9886e5ff5bf6074bcb6aa673ca826421e10bc31
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ require:
2
+ - rubocop-rspec
3
+
1
4
  AllCops:
2
5
  NewCops: enable
3
6
  SuggestExtensions: false
@@ -12,5 +15,17 @@ Lint/InterpolationCheck:
12
15
  Metrics:
13
16
  Enabled: false
14
17
 
18
+ RSpec/AnyInstance:
19
+ Enabled: false
20
+
21
+ RSpec/ImplicitSubject:
22
+ Enabled: false
23
+
24
+ RSpec/MultipleExpectations:
25
+ Enabled: false
26
+
27
+ RSpec/NamedSubject:
28
+ Enabled: false
29
+
15
30
  Style/Documentation:
16
31
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.4.2 - 2021-12-27
6
+
7
+ ### Fixed
8
+
9
+ - Fix bug on quoted attribute parser.
10
+ - Remove trailing line-ending from source line of syntax error message.
11
+ - Support multi-line attributes.
12
+
5
13
  ## 0.4.1 - 2021-12-26
6
14
 
7
15
  ### Fixed
@@ -24,7 +32,7 @@
24
32
 
25
33
  ### Added
26
34
 
27
- - Support unquoted attributes.
35
+ - Support Ruby attributes.
28
36
 
29
37
  ### Fixed
30
38
 
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
- gem 'rspec', '~> 3.0'
10
- gem 'rubocop', '~> 1.21'
9
+ gem 'rspec'
10
+ gem 'rubocop'
11
+ gem 'rubocop-rspec'
11
12
  gem 'slim'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slimi (0.4.1)
4
+ slimi (0.4.2)
5
5
  temple
6
6
 
7
7
  GEM
@@ -40,6 +40,8 @@ GEM
40
40
  unicode-display_width (>= 1.4.0, < 3.0)
41
41
  rubocop-ast (1.15.0)
42
42
  parser (>= 3.0.1.1)
43
+ rubocop-rspec (2.6.0)
44
+ rubocop (~> 1.19)
43
45
  ruby-progressbar (1.11.0)
44
46
  slim (4.1.0)
45
47
  temple (>= 0.7.6, < 0.9)
@@ -53,8 +55,9 @@ PLATFORMS
53
55
 
54
56
  DEPENDENCIES
55
57
  rake (~> 13.0)
56
- rspec (~> 3.0)
57
- rubocop (~> 1.21)
58
+ rspec
59
+ rubocop
60
+ rubocop-rspec
58
61
  slim
59
62
  slimi!
60
63
 
data/lib/slimi/errors.rb CHANGED
@@ -23,7 +23,7 @@ module Slimi
23
23
  def to_s
24
24
  <<~TEXT
25
25
  #{error_type} at #{@file_path}:#{@line_number}:#{@column}
26
- #{@line}
26
+ #{@line.rstrip}
27
27
  #{' ' * (@column - 1)}^
28
28
  TEXT
29
29
  end
@@ -36,6 +36,9 @@ module Slimi
36
36
  end
37
37
  end
38
38
 
39
+ class AttributeClosingDelimiterNotFoundError < SlimSyntaxError
40
+ end
41
+
39
42
  class InvalidEmptyAttributeError < SlimSyntaxError
40
43
  end
41
44
 
data/lib/slimi/parser.rb CHANGED
@@ -220,18 +220,24 @@ module Slimi
220
220
  value = +''
221
221
  count = 0
222
222
  loop do
223
- if @scanner.match?(/#{quote}/) && count.zero?
224
- end_ = @scanner.charpos
225
- @scanner.pos += @scanner.matched_size
226
- break
227
- end
228
-
229
- if @scanner.skip(/\{/)
223
+ if @scanner.match?(/#{quote}/)
224
+ if count.zero?
225
+ end_ = @scanner.charpos
226
+ @scanner.pos += @scanner.matched_size
227
+ break
228
+ else
229
+ @scanner.pos += @scanner.matched_size
230
+ value << @scanner.matched
231
+ end
232
+ elsif @scanner.skip(/\{/)
230
233
  count += 1
234
+ value << @scanner.matched
231
235
  elsif @scanner.skip(/\}/)
232
236
  count -= 1
237
+ value << @scanner.matched
238
+ else
239
+ value << @scanner.scan(/[^{}#{quote}]*/)
233
240
  end
234
- value << @scanner.scan(/[^{}#{quote}]*/)
235
241
  end
236
242
  [:slimi, :interpolate, begin_, end_, value]
237
243
  end
@@ -273,7 +279,10 @@ module Slimi
273
279
  elsif @scanner.skip(attribute_delimiter_closing_part_regexp) # rubocop:disable Lint/DuplicateBranch
274
280
  break
275
281
  else
276
- raise ::NotImplementedError
282
+ @scanner.skip(/[ \t]+/)
283
+ expect_line_ending
284
+
285
+ syntax_error!(Errors::AttributeClosingDelimiterNotFoundError) if @scanner.eos?
277
286
  end
278
287
  end
279
288
 
data/lib/slimi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Slimi
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slimi
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
  - Ryo Nakamura