lib/nanoc/data_sources/filesystem.rb in nanoc-3.7.2 vs lib/nanoc/data_sources/filesystem.rb in nanoc-3.7.3
- old
+ new
@@ -255,11 +255,11 @@
if data !~ /\A-{3,5}\s*$/
return [ {}, data ]
end
# Split data
- pieces = data.split(/^(-{5}|-{3})[ \t]*\n/)
+ pieces = data.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
if pieces.size < 4
raise RuntimeError.new(
"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format."
)
end
@@ -268,10 +268,10 @@
begin
meta = YAML.load(pieces[2]) || {}
rescue Exception => e
raise "Could not parse YAML for #{content_filename}: #{e.message}"
end
- content = pieces[4..-1].join
+ content = pieces[4]
# Done
[ meta, content ]
end