lib/slim_lint/document.rb in slim_lint-0.5.0 vs lib/slim_lint/document.rb in slim_lint-0.6.0
- old
+ new
@@ -33,16 +33,25 @@
end
private
# @param source [String] Slim code to parse
- # @raise [Slim::Parser::Error] if there was a problem parsing the document
+ # @raise [SlimLint::Exceptions::ParseError] if there was a problem parsing the document
def process_source(source)
+ @source = process_encoding(source)
@source = strip_frontmatter(source)
@source_lines = @source.split("\n")
engine = SlimLint::Engine.new(file: @file)
@sexp = engine.parse(source)
+ end
+
+ # Ensure the string's encoding is valid.
+ #
+ # @param source [String]
+ # @return [String] source encoded in a valid encoding
+ def process_encoding(source)
+ ::Temple::Filters::Encoding.new.call(source)
end
# Removes YAML frontmatter
def strip_frontmatter(source)
if config['skip_frontmatter'] &&