mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-10 23:48:18 -05:00
don't prematurely terminate front matter on mid-line triple dashes. fixes #93
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
==
|
||||
* Bug Fixes
|
||||
* Require redcloth >= 4.2.1 in tests (#92)
|
||||
* Don't break on triple dashes in yaml frontmatter (#93)
|
||||
* Minor Enhancements
|
||||
* Allow .mkd as markdown extension
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ module Jekyll
|
||||
def read_yaml(base, name)
|
||||
self.content = File.read(File.join(base, name))
|
||||
|
||||
if self.content =~ /^(---\s*\n.*?\n?)(---.*?\n)/m
|
||||
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
self.content = self.content[($1.size + $2.size)..-1]
|
||||
|
||||
self.data = YAML.load($1)
|
||||
|
||||
5
test/source/_posts/2010-01-08-triple-dash.markdown
Normal file
5
test/source/_posts/2010-01-08-triple-dash.markdown
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: Foo --- Bar
|
||||
---
|
||||
|
||||
Triple the fun!
|
||||
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "ensure post count is as expected" do
|
||||
assert_equal 17, @site.posts.size
|
||||
assert_equal 18, @site.posts.size
|
||||
end
|
||||
|
||||
should "insert site.posts into the index" do
|
||||
|
||||
@@ -77,7 +77,19 @@ 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\nThis is the content", @post.content
|
||||
assert_equal "This is the content", @post.content
|
||||
end
|
||||
end
|
||||
|
||||
context "with embedded triple dash" do
|
||||
setup do
|
||||
@real_file = "2010-01-08-triple-dash.markdown"
|
||||
end
|
||||
should "consume the embedded dashes" do
|
||||
@post.read_yaml(@source, @real_file)
|
||||
|
||||
assert_equal({"title" => "Foo --- Bar"}, @post.data)
|
||||
assert_equal "Triple the fun!", @post.content
|
||||
end
|
||||
end
|
||||
|
||||
@@ -163,7 +175,7 @@ class TestPost < Test::Unit::TestCase
|
||||
@post.read_yaml(@source, @real_file)
|
||||
|
||||
assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data)
|
||||
assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", @post.content
|
||||
assert_equal "h1. {{ page.title }}\n\nBest *post* ever", @post.content
|
||||
end
|
||||
|
||||
should "transform textile" do
|
||||
|
||||
Reference in New Issue
Block a user