slim_lint 0.8.0 → 0.8.1
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/atom.rb +4 -0
- data/lib/slim_lint/filters/inject_line_numbers.rb +9 -8
- data/lib/slim_lint/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b094bc119ab2bdbf1ab0ca089eadc98cf992ef1
|
4
|
+
data.tar.gz: 47cfef021e1e6177924cca9ce513e44d573b4f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eac53c872941edabccee0d4dcc2651c2c15fbcfcf035bf7d54ceff12b69486927c283b939c50f4c41e2b8b6842aed0c80fcd7b43e56e4905482990b2427794c
|
7
|
+
data.tar.gz: 776f41c394cce7be9bfb5de63367c9f1566f3fcde5100d39b21d289d985497728208fa142d5ec7697af888383e5a90d9a2f36e6d4f015db0e693fb8474ce99ec
|
data/lib/slim_lint/atom.rb
CHANGED
@@ -4,6 +4,10 @@ module SlimLint
|
|
4
4
|
# This creates a light wrapper around literal values of S-expressions so we
|
5
5
|
# can make an {Atom} quack like a {Sexp} without being an {Sexp}.
|
6
6
|
class Atom
|
7
|
+
# Stores the line number of the code in the original document that this Atom
|
8
|
+
# came from.
|
9
|
+
attr_accessor :line
|
10
|
+
|
7
11
|
# Creates an atom from the specified value.
|
8
12
|
#
|
9
13
|
# @param value [Object]
|
@@ -20,20 +20,21 @@ module SlimLint::Filters
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
# Traverses an {Sexp}, annotating it with line numbers
|
24
|
-
# newline abstractions within it.
|
23
|
+
# Traverses an {Sexp}, annotating it with line numbers.
|
25
24
|
#
|
26
25
|
# @param sexp [SlimLint::Sexp]
|
27
26
|
def traverse(sexp)
|
28
27
|
sexp.line = @line_number
|
29
28
|
|
30
|
-
|
29
|
+
case sexp
|
30
|
+
when SlimLint::Atom
|
31
|
+
@line_number += sexp.count("\n") if sexp.respond_to?(:count)
|
32
|
+
when NEWLINE_SEXP
|
31
33
|
@line_number += 1
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
traverse(nested_sexp) if nested_sexp.is_a?(SlimLint::Sexp)
|
34
|
+
else
|
35
|
+
sexp.each do |nested_sexp|
|
36
|
+
traverse(nested_sexp)
|
37
|
+
end
|
37
38
|
end
|
38
39
|
end
|
39
40
|
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.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -179,8 +179,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.5.1
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Slim template linting tool
|
186
186
|
test_files: []
|
187
|
+
has_rdoc:
|