Merge pull request #946 from maul-esel/preserve_excerpt

Preserve 'excerpt` in YAML Front-Matter
This commit is contained in:
Parker Moore
2013-04-12 06:24:51 -07:00
4 changed files with 44 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
---
layout: ~
excerpt: 'I can set a custom excerpt'
---
This is not my excerpt.
Neither is this.
I can use the excerpt: <quote>{{page.excerpt}}</quote>

View File

@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end
should "ensure post count is as expected" do
assert_equal 31, @site.posts.size
assert_equal 32, @site.posts.size
end
should "insert site.posts into the index" do

View File

@@ -320,6 +320,24 @@ class TestPost < Test::Unit::TestCase
assert !@post.excerpt.include?("---"), "does not contains separator"
end
end
context "with custom excerpt" do
setup do
file = "2013-04-11-custom-excerpt.markdown"
@post = setup_post(file)
do_render(@post)
end
should "use custom excerpt" do
assert_equal("I can set a custom excerpt", @post.excerpt)
end
should "expose custom excerpt to liquid" do
assert @post.content.include?("I can use the excerpt: <quote>I can set a custom excerpt</quote>"), "Exposes incorrect excerpt to liquid."
end
end
end
end