haml_lint 0.16.1 → 0.16.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da38b97b1a00ab0532028ecd781baab6498e8be2
4
- data.tar.gz: 8303c933ecabcad4820c83430417bb5ceb441cee
3
+ metadata.gz: 09f4e89dbdf8cff5d12bd8dd62eca4c2f6189f7a
4
+ data.tar.gz: f941c7d6cd1d3bbb0c5e3602c7e1edd4d23881d7
5
5
  SHA512:
6
- metadata.gz: 5f2ff5a40d5393c30694bf40848f336d35831154db37ac161162788b57d7ed5af8b86e4494610c5de56215a1b4b43ca3d183a45d7f53a64e6097485f8b2c0dfb
7
- data.tar.gz: eb110dd3205ffc7e29284c101faaa0fd483c56153989f137ed41234f402764fa00cc22df0fb1654663f9bba12825a4fbeab7e2da38bb8ffbb8706e465bdc5ccc
6
+ metadata.gz: 150b1597d322f8fff6fa25f6b615cb1ca1012a222f03b13592f43c2682bf99ccbd2b5e41c05149a56d3477d44de32b21b2291cbc174389a3b7fe524dde4ac028
7
+ data.tar.gz: e1536df0d216348dafd1b345ca1a0c7b870d79ef2ea847ef72c5056637bd44cea4940b6552d03aaed74c21f6437c816bfd641fabd69ce9661133639c07c571a0
@@ -98,20 +98,22 @@ module HamlLint
98
98
 
99
99
  # Removes YAML frontmatter
100
100
  def strip_frontmatter(source)
101
- if config['skip_frontmatter'] &&
102
- source =~ /
103
- # From the start of the string
104
- \A
105
- # First-capture match --- followed by optional whitespace up
106
- # to a newline then 0 or more chars followed by an optional newline.
107
- # This matches the --- and the contents of the frontmatter
108
- (---\s*\n.*?\n?)
109
- # From the start of the line
110
- ^
111
- # Second capture match --- or ... followed by optional whitespace
112
- # and newline. This matches the closing --- for the frontmatter.
113
- (---|\.\.\.)\s*$\n?/mx
114
- source = $POSTMATCH
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)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.16.1'.freeze
5
+ VERSION = '0.16.2'.freeze
6
6
  end
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.1
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-02-16 00:00:00.000000000 Z
12
+ date: 2016-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml