lib/jekyll/convertible.rb in PerfectlyNormal-jekyll-0.5.1 vs lib/jekyll/convertible.rb in PerfectlyNormal-jekyll-0.5.3
- old
+ new
@@ -15,15 +15,17 @@
# +name+ is the String filename of the file
#
# Returns nothing
def read_yaml(base, name)
self.content = File.read(File.join(base, name))
-
- if self.content =~ /^(---\s*\n.*?)\n---\s*\n/m
- self.content = self.content[($1.size + 5)..-1]
-
+
+ if self.content =~ /^(---\s*\n.*?\n?)(---.*?\n)/m
+ self.content = self.content[($1.size + $2.size)..-1]
+
self.data = YAML.load($1)
end
+
+ self.data ||= {}
end
# Transform the contents based on the file extension.
#
# Returns nothing