Fix JSON frontmatter parsing

This commit is contained in:
Eliott Appleford 2015-09-24 20:27:36 +01:00
parent fe66beacc3
commit 97cd1c1411

View file

@ -24,7 +24,7 @@ module Middleman::Util::Data
end
/
\A(.*?coding:.*?\n)?
\A(.*?coding:.*?\r?\n)?
(?<start>[-;]{3})[ ]*\r?\n
(?<frontmatter>.*?)[ ]*\r?\n?
(?<stop>^[-.;]{3})[ ]*\r?\n?
@ -44,7 +44,7 @@ module Middleman::Util::Data
when %w(--- ---), %w(--- ...)
[parse_yaml(frontmatter, full_path), additional_content]
when %w(;;; ;;;)
[parse_json(frontmatter, full_path), additional_content]
[parse_json("{#{frontmatter}}", full_path), additional_content]
else
[{}, content]
end