slim_lint 0.25.0 → 0.26.0
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/slim_lint/linter/control_statement_spacing.rb +2 -32
- data/lib/slim_lint/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 007f6af5a15bd9858e04011b2fa0b604bc523148929b96852f44661b95fb1f66
|
4
|
+
data.tar.gz: 156ad192dc47014b863c9be9840f2280ee3174aa98bb96588b34017ffa7d470e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30e9a1af1ba6b00cdc64037fa862eb2b40789e81f6d846183d84755a37396de87a7606ef30b8c11955ca3dc41fe691a157b5b2e75b737b73a03dfaecde8279c3
|
7
|
+
data.tar.gz: 2664127ced343842a71564c9be8b146f39a5d0374c48bb4c6f41fe764c021507542a81ddc24c9df3b12fab79d62408c2971179f9b57b02e5781846b31922c63d
|
@@ -9,14 +9,8 @@ module SlimLint
|
|
9
9
|
|
10
10
|
on [:html, :tag, anything, [],
|
11
11
|
[:slim, :output, anything, capture(:ruby, anything)]] do |sexp|
|
12
|
-
#
|
13
|
-
|
14
|
-
source = merge_multiline_attributes(document.source_lines)
|
15
|
-
|
16
|
-
# Fetch processed Slim code that contains an element with a control statement.
|
17
|
-
line = source[sexp.line - 1][:line]
|
18
|
-
# Apply correction to the line count.
|
19
|
-
sexp.line += source[sexp.line - 1][:line_count]
|
12
|
+
# Fetch original Slim code that contains an element with a control statement.
|
13
|
+
line = document.source_lines[sexp.line - 1]
|
20
14
|
|
21
15
|
# Remove any Ruby code, because our regexp below must not match inside Ruby.
|
22
16
|
ruby = captures[:ruby]
|
@@ -26,29 +20,5 @@ module SlimLint
|
|
26
20
|
|
27
21
|
report_lint(sexp, MESSAGE)
|
28
22
|
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def merge_multiline_attributes(source_lines)
|
33
|
-
result = []
|
34
|
-
memo = ''
|
35
|
-
correction_line_count = 0
|
36
|
-
|
37
|
-
source_lines.each do |line|
|
38
|
-
memo += line.chomp('\\')
|
39
|
-
|
40
|
-
# Lines ending in a backslash are concatenated with the next line
|
41
|
-
# And count the number of lines to correct the sexp line count.
|
42
|
-
if line.match?(/\\$/)
|
43
|
-
correction_line_count += 1
|
44
|
-
next
|
45
|
-
end
|
46
|
-
|
47
|
-
# Add merged rows and correction line count to the result and reset the memo
|
48
|
-
result << { line: memo, line_count: correction_line_count }
|
49
|
-
memo = ''
|
50
|
-
end
|
51
|
-
result
|
52
|
-
end
|
53
23
|
end
|
54
24
|
end
|
data/lib/slim_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -149,7 +149,7 @@ homepage: https://github.com/sds/slim-lint
|
|
149
149
|
licenses:
|
150
150
|
- MIT
|
151
151
|
metadata: {}
|
152
|
-
post_install_message:
|
152
|
+
post_install_message:
|
153
153
|
rdoc_options: []
|
154
154
|
require_paths:
|
155
155
|
- lib
|
@@ -164,8 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
167
|
+
rubygems_version: 3.4.10
|
168
|
+
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Slim template linting tool
|
171
171
|
test_files: []
|