haml_lint 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/haml_lint/document.rb +16 -14
- data/lib/haml_lint/linter/unnecessary_string_output.rb +1 -1
- data/lib/haml_lint/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09f4e89dbdf8cff5d12bd8dd62eca4c2f6189f7a
|
4
|
+
data.tar.gz: f941c7d6cd1d3bbb0c5e3602c7e1edd4d23881d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 150b1597d322f8fff6fa25f6b615cb1ca1012a222f03b13592f43c2682bf99ccbd2b5e41c05149a56d3477d44de32b21b2291cbc174389a3b7fe524dde4ac028
|
7
|
+
data.tar.gz: e1536df0d216348dafd1b345ca1a0c7b870d79ef2ea847ef72c5056637bd44cea4940b6552d03aaed74c21f6437c816bfd641fabd69ce9661133639c07c571a0
|
data/lib/haml_lint/document.rb
CHANGED
@@ -98,20 +98,22 @@ module HamlLint
|
|
98
98
|
|
99
99
|
# Removes YAML frontmatter
|
100
100
|
def strip_frontmatter(source)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
101
|
+
frontmatter = /
|
102
|
+
# From the start of the string
|
103
|
+
\A
|
104
|
+
# First-capture match --- followed by optional whitespace up
|
105
|
+
# to a newline then 0 or more chars followed by an optional newline.
|
106
|
+
# This matches the --- and the contents of the frontmatter
|
107
|
+
(---\s*\n.*?\n?)
|
108
|
+
# From the start of the line
|
109
|
+
^
|
110
|
+
# Second capture match --- or ... followed by optional whitespace
|
111
|
+
# and newline. This matches the closing --- for the frontmatter.
|
112
|
+
(---|\.\.\.)\s*$\n?/mx
|
113
|
+
|
114
|
+
if config['skip_frontmatter'] && match = source.match(frontmatter)
|
115
|
+
newlines = match[0].count("\n")
|
116
|
+
source.sub!(frontmatter, "\n" * newlines)
|
115
117
|
end
|
116
118
|
|
117
119
|
source
|
@@ -22,7 +22,7 @@ module HamlLint
|
|
22
22
|
def visit_script(node)
|
23
23
|
# Some script nodes created by the HAML parser aren't actually script
|
24
24
|
# nodes declared via the `=` marker. Check for it.
|
25
|
-
return if node.source_code !~ /\s*=/
|
25
|
+
return if node.source_code !~ /\A\s*=/
|
26
26
|
|
27
27
|
if outputs_string_literal?(node)
|
28
28
|
record_lint(node, MESSAGE)
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|