diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index fd457177..8f42865c 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -17,11 +17,11 @@ module Jekyll # Returns nothing def read_yaml(base, name) self.content = File.read(File.join(base, name)) - - if self.content =~ /^(---\s*\n.*?)\r?\n---\s*\n/m - self.content = self.content[($1.size + 5)..-1] - - self.data = YAML.load($1.dup) + + if self.content =~ /^(---\s*\n.*?\n?)(---.*?\n)/m + self.content = self.content[($1.size + $2.size)..-1] + + self.data = YAML.load($1) end end diff --git a/test/test_post.rb b/test/test_post.rb index ed8a4d2d..0176ac18 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -77,7 +77,7 @@ class TestPost < Test::Unit::TestCase @post.read_yaml(@source, @real_file) assert_equal({"title" => "Test title", "layout" => "post", "tag" => "Ruby"}, @post.data) - assert_equal "\r\n\r\nThis is the content", @post.content + assert_equal "\r\nThis is the content", @post.content end end