mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Merge pull request #946 from maul-esel/preserve_excerpt
Preserve 'excerpt` in YAML Front-Matter
This commit is contained in:
10
test/source/_posts/2013-04-11-custom-excerpt.markdown
Normal file
10
test/source/_posts/2013-04-11-custom-excerpt.markdown
Normal 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>
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user