Merge pull request #3528 from willnorris/textile

This commit is contained in:
Matt Rogers 2015-02-28 21:44:29 -06:00
commit 7d6d29b4ca
25 changed files with 27 additions and 27 deletions

View File

@ -88,7 +88,7 @@ class TestExcerpt < JekyllUnitTest
assert_gets_called = false assert_gets_called = false
klass.send(:define_method, :assert_gets_called) { assert_gets_called = true } klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called']) klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
post = klass.new(@site, source_dir, '', "2008-02-02-published.textile") post = klass.new(@site, source_dir, '', "2008-02-02-published.markdown")
Jekyll::Excerpt.new(post).to_liquid Jekyll::Excerpt.new(post).to_liquid
assert assert_gets_called, 'assert_gets_called did not get called on post.' assert assert_gets_called, 'assert_gets_called did not get called on post.'

View File

@ -82,14 +82,14 @@ class TestPost < JekyllUnitTest
post = Post.allocate post = Post.allocate
post.categories = ['foo'] post.categories = ['foo']
post.site = @site post.site = @site
post.process("cat1/2008-09-09-foo-bar.textile") post.process("cat1/2008-09-09-foo-bar.markdown")
assert_equal 1, post.categories.size assert_equal 1, post.categories.size
assert_equal "foo", post.categories[0] assert_equal "foo", post.categories[0]
post = Post.allocate post = Post.allocate
post.categories = ['foo', 'bar'] post.categories = ['foo', 'bar']
post.site = @site post.site = @site
post.process("cat2/CAT3/2008-09-09-foo-bar.textile") post.process("cat2/CAT3/2008-09-09-foo-bar.markdown")
assert_equal 2, post.categories.size assert_equal 2, post.categories.size
assert_equal "foo", post.categories[0] assert_equal "foo", post.categories[0]
assert_equal "bar", post.categories[1] assert_equal "bar", post.categories[1]
@ -104,7 +104,7 @@ class TestPost < JekyllUnitTest
should "raise a good error on invalid post date" do should "raise a good error on invalid post date" do
assert_raises Jekyll::Errors::FatalException do assert_raises Jekyll::Errors::FatalException do
@post.process("2009-27-03-foo-bar.textile") @post.process("2009-27-03-foo-bar.markdown")
end end
end end
@ -131,7 +131,7 @@ class TestPost < JekyllUnitTest
end end
should "respect permalink in yaml front matter" do should "respect permalink in yaml front matter" do
file = "2008-12-03-permalinked-post.textile" file = "2008-12-03-permalinked-post.markdown"
@post.process(file) @post.process(file)
@post.read_yaml(@source, file) @post.read_yaml(@source, file)
@ -230,7 +230,7 @@ class TestPost < JekyllUnitTest
context "with specified layout of nil" do context "with specified layout of nil" do
setup do setup do
file = '2013-01-12-nil-layout.textile' file = '2013-01-12-nil-layout.markdown'
@post = setup_post(file) @post = setup_post(file)
@post.process(file) @post.process(file)
end end
@ -369,7 +369,7 @@ class TestPost < JekyllUnitTest
assert_equal "# {{ page.title }}\n\nBest **post** ever", @post.content assert_equal "# {{ page.title }}\n\nBest **post** ever", @post.content
end end
should "transform textile" do should "transform markdown" do
@post.process(@real_file) @post.process(@real_file)
@post.read_yaml(@source, @real_file) @post.read_yaml(@source, @real_file)
assert_equal "<h1 id=\"pagetitle-\">{{ page.title }}</h1>\n\n<p>Best <strong>post</strong> ever</p>", @post.transform.strip assert_equal "<h1 id=\"pagetitle-\">{{ page.title }}</h1>\n\n<p>Best <strong>post</strong> ever</p>", @post.transform.strip
@ -461,8 +461,8 @@ class TestPost < JekyllUnitTest
setup do setup do
clear_dest clear_dest
@site = fixture_site @site = fixture_site
@site.posts = [setup_post('2008-02-02-published.textile'), @site.posts = [setup_post('2008-02-02-published.markdown'),
setup_post('2009-01-27-categories.textile')] setup_post('2009-01-27-categories.markdown')]
end end
should "have next post" do should "have next post" do
@ -511,7 +511,7 @@ class TestPost < JekyllUnitTest
end end
should "to_liquid prioritizes post attributes over data" do should "to_liquid prioritizes post attributes over data" do
post = setup_post("2010-01-16-override-data.textile") post = setup_post("2010-01-16-override-data.markdown")
assert_equal Array, post.tags.class assert_equal Array, post.tags.class
assert_equal Array, post.to_liquid["tags"].class assert_equal Array, post.to_liquid["tags"].class
assert_equal Time, post.date.class assert_equal Time, post.date.class
@ -523,36 +523,36 @@ class TestPost < JekyllUnitTest
assert_gets_called = false assert_gets_called = false
klass.send(:define_method, :assert_gets_called) { assert_gets_called = true } klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called']) klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
post = klass.new(@site, source_dir, '', "2008-02-02-published.textile") post = klass.new(@site, source_dir, '', "2008-02-02-published.markdown")
do_render(post) do_render(post)
assert assert_gets_called, 'assert_gets_called did not get called on post.' assert assert_gets_called, 'assert_gets_called did not get called on post.'
end end
should "recognize category in yaml" do should "recognize category in yaml" do
post = setup_post("2009-01-27-category.textile") post = setup_post("2009-01-27-category.markdown")
assert post.categories.include?('foo') assert post.categories.include?('foo')
end end
should "recognize several categories in yaml" do should "recognize several categories in yaml" do
post = setup_post("2009-01-27-categories.textile") post = setup_post("2009-01-27-categories.markdown")
assert post.categories.include?('foo') assert post.categories.include?('foo')
assert post.categories.include?('bar') assert post.categories.include?('bar')
assert post.categories.include?('baz') assert post.categories.include?('baz')
end end
should "recognize empty category in yaml" do should "recognize empty category in yaml" do
post = setup_post("2009-01-27-empty-category.textile") post = setup_post("2009-01-27-empty-category.markdown")
assert_equal [], post.categories assert_equal [], post.categories
end end
should "recognize empty categories in yaml" do should "recognize empty categories in yaml" do
post = setup_post("2009-01-27-empty-categories.textile") post = setup_post("2009-01-27-empty-categories.markdown")
assert_equal [], post.categories assert_equal [], post.categories
end end
should "recognize number category in yaml" do should "recognize number category in yaml" do
post = setup_post("2013-05-10-number-category.textile") post = setup_post("2013-05-10-number-category.markdown")
assert post.categories.include?('2013') assert post.categories.include?('2013')
assert !post.categories.include?(2013) assert !post.categories.include?(2013)
end end
@ -564,34 +564,34 @@ class TestPost < JekyllUnitTest
end end
should "recognize tag in yaml" do should "recognize tag in yaml" do
post = setup_post("2009-05-18-tag.textile") post = setup_post("2009-05-18-tag.markdown")
assert post.tags.include?('code') assert post.tags.include?('code')
end end
should "recognize tags in yaml" do should "recognize tags in yaml" do
post = setup_post("2009-05-18-tags.textile") post = setup_post("2009-05-18-tags.markdown")
assert post.tags.include?('food') assert post.tags.include?('food')
assert post.tags.include?('cooking') assert post.tags.include?('cooking')
assert post.tags.include?('pizza') assert post.tags.include?('pizza')
end end
should "recognize empty tag in yaml" do should "recognize empty tag in yaml" do
post = setup_post("2009-05-18-empty-tag.textile") post = setup_post("2009-05-18-empty-tag.markdown")
assert_equal [], post.tags assert_equal [], post.tags
end end
should "recognize empty tags in yaml" do should "recognize empty tags in yaml" do
post = setup_post("2009-05-18-empty-tags.textile") post = setup_post("2009-05-18-empty-tags.markdown")
assert_equal [], post.tags assert_equal [], post.tags
end end
should "allow no yaml" do should "allow no yaml" do
post = setup_post("2009-06-22-no-yaml.textile") post = setup_post("2009-06-22-no-yaml.markdown")
assert_equal "No YAML.", post.content assert_equal "No YAML.", post.content
end end
should "allow empty yaml" do should "allow empty yaml" do
post = setup_post("2009-06-22-empty-yaml.textile") post = setup_post("2009-06-22-empty-yaml.markdown")
assert_equal "Empty YAML.", post.content assert_equal "Empty YAML.", post.content
end end
@ -691,7 +691,7 @@ class TestPost < JekyllUnitTest
end end
should "generate categories and topics" do should "generate categories and topics" do
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile') post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.markdown')
assert_equal ['foo'], post.categories assert_equal ['foo'], post.categories
end end
end end
@ -756,12 +756,12 @@ class TestPost < JekyllUnitTest
end end
should "return category if post does not specify category" do should "return category if post does not specify category" do
post = setup_post("2009-01-27-no-category.textile") post = setup_post("2009-01-27-no-category.markdown")
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not." assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
end end
should "override site category if set on post" do should "override site category if set on post" do
post = setup_post("2009-01-27-category.textile") post = setup_post("2009-01-27-category.markdown")
assert post.categories.include?('foo'), "Expected post.categories to include 'foo' but did not." assert post.categories.include?('foo'), "Expected post.categories to include 'foo' but did not."
assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did." assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
end end
@ -779,12 +779,12 @@ class TestPost < JekyllUnitTest
end end
should "return categories if post does not specify categories" do should "return categories if post does not specify categories" do
post = setup_post("2009-01-27-no-category.textile") post = setup_post("2009-01-27-no-category.markdown")
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not." assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
end end
should "override site categories if set on post" do should "override site categories if set on post" do
post = setup_post("2009-01-27-categories.textile") post = setup_post("2009-01-27-categories.markdown")
['foo', 'bar', 'baz'].each do |category| ['foo', 'bar', 'baz'].each do |category|
assert post.categories.include?(category), "Expected post.categories to include '#{category}' but did not." assert post.categories.include?(category), "Expected post.categories to include '#{category}' but did not."
end end