haml_lint 0.15.1 → 0.15.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 +4 -4
- data/lib/haml_lint/document.rb +13 -0
- data/lib/haml_lint/utils.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: 80e71cdb5e58b93dd53b7e4fe3eef1bba2002af5
|
4
|
+
data.tar.gz: a724e0a1cb1748cce64d430cd4ba34e82fc904ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202ce87309496ebb5372e607f734348e9532a1c83cde72ada2b88fe2e6a5b5d4d26459b181de83e838bd35685dd12b36bf0b7b25405351811f734a809f78d6c8
|
7
|
+
data.tar.gz: f82080cf1c10090eee512efd10ef85eac22e751d49d488e9f94d889eed191c1203b85bd00411c1cb3b77a1076a93908ce18078213f9906427e1a2f51d8212ac2
|
data/lib/haml_lint/document.rb
CHANGED
@@ -37,6 +37,7 @@ module HamlLint
|
|
37
37
|
# @param source [String] Haml code to parse
|
38
38
|
# @raise [HamlLint::Exceptions::ParseError] if there was a problem parsing
|
39
39
|
def process_source(source)
|
40
|
+
@source = process_encoding(source)
|
40
41
|
@source = strip_frontmatter(source)
|
41
42
|
@source_lines = @source.split("\n")
|
42
43
|
|
@@ -81,6 +82,18 @@ module HamlLint
|
|
81
82
|
new_node
|
82
83
|
end
|
83
84
|
|
85
|
+
# Ensures source code is interpreted as UTF-8.
|
86
|
+
#
|
87
|
+
# This is necessary as sometimes Ruby guesses the encoding of a file
|
88
|
+
# incorrectly, for example if the LC_ALL environment variable is set to "C".
|
89
|
+
# @see http://unix.stackexchange.com/a/87763
|
90
|
+
#
|
91
|
+
# @param source [String]
|
92
|
+
# @return [String] source encoded with UTF-8 encoding
|
93
|
+
def process_encoding(source)
|
94
|
+
source.force_encoding(Encoding::UTF_8)
|
95
|
+
end
|
96
|
+
|
84
97
|
# Removes YAML frontmatter
|
85
98
|
def strip_frontmatter(source)
|
86
99
|
if config['skip_frontmatter'] &&
|
data/lib/haml_lint/utils.rb
CHANGED
@@ -65,7 +65,7 @@ module HamlLint
|
|
65
65
|
# @param str [String]
|
66
66
|
# @return [String]
|
67
67
|
def camel_case(str)
|
68
|
-
str.split(/_|-| /).map { |part| part.sub(/^\w
|
68
|
+
str.split(/_|-| /).map { |part| part.sub(/^\w/, &:upcase) }.join
|
69
69
|
end
|
70
70
|
|
71
71
|
# Find all consecutive items satisfying the given block of a minimum size,
|
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.15.
|
4
|
+
version: 0.15.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: 2015-09-
|
12
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|