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 +4 -4
- data/.rubocop.yml +15 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile +3 -2
- data/Gemfile.lock +6 -3
- data/lib/slimi/errors.rb +4 -1
- data/lib/slimi/parser.rb +18 -9
- data/lib/slimi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a503c590465e63f43b6d9ef8047700ff415bfea923df65be323f2d37f5d94b71
|
4
|
+
data.tar.gz: 4ad486738d38c81b670cb693afa31c9c7f8acb92ab05a844d47cf3df1d0219c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
35
|
+
- Support Ruby attributes.
|
28
36
|
|
29
37
|
### Fixed
|
30
38
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
slimi (0.4.
|
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
|
57
|
-
rubocop
|
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}/)
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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
|
-
|
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