fix error for case with broken encoding
This commit is contained in:
parent
2dbce8ca9f
commit
a5a6900948
|
@ -25,14 +25,16 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def read_yaml(base, name)
|
||||
begin
|
||||
self.content = File.read(File.join(base, name))
|
||||
|
||||
begin
|
||||
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
self.content = $POSTMATCH
|
||||
self.data = YAML.load($1)
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "Error reading file #{name}: #{e.message}"
|
||||
rescue SyntaxError => e
|
||||
puts "YAML Exception reading #{name}: #{e.message}"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue