diff --git a/Gemfile b/Gemfile index 5649d19f..88d5e641 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ gem 'redgreen', '~> 1.2' gem 'shoulda', '~> 3.5' gem 'rr', '~> 1.1' gem 'cucumber', '1.3.18' -gem 'RedCloth', '~> 4.2' gem 'maruku', '~> 0.7.0' gem 'rdiscount', '~> 2.0' gem 'launchy', '~> 2.3' diff --git a/features/drafts.feature b/features/drafts.feature index c55edbb9..5d7982ec 100644 --- a/features/drafts.feature +++ b/features/drafts.feature @@ -43,4 +43,4 @@ Feature: Draft Posts | Recipe | 2009-03-27 | simple | Post path: {{ page.path }} | When I run jekyll build --drafts Then the _site directory should exist - And I should see "Post path: _drafts/recipe.textile" in "_site/recipe.html" + And I should see "Post path: _drafts/recipe.markdown" in "_site/recipe.html" diff --git a/features/embed_filters.feature b/features/embed_filters.feature index 889a1fc7..d6f99fc7 100644 --- a/features/embed_filters.feature +++ b/features/embed_filters.feature @@ -20,8 +20,6 @@ Feature: Embed filters And I have the following post: | title | date | layout | content | | Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. | - - And I have a default layout that contains "{{ page.title | xml_escape }}" When I run jekyll build Then the _site directory should exist @@ -33,7 +31,7 @@ Feature: Embed filters And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | - And I have a default layout that contains "{{ content | xml_escape }}" + And I have a default layout that contains "{{ content | number_of_words }}" When I run jekyll build Then the _site directory should exist And I should see "7" in "_site/2009/03/27/star-wars.html" @@ -49,13 +47,13 @@ Feature: Embed filters Then the _site directory should exist And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html" - Scenario: Textilize a given string + Scenario: Markdownify a given string Given I have a _posts directory And I have a _layouts directory And I have the following post: | title | date | layout | content | | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | - And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}" + And I have a default layout that contains "By {{ '_Obi-wan_' | markdownify }}" When I run jekyll build Then the _site directory should exist And I should see "By
Obi-wan
" in "_site/2009/03/27/star-wars.html" diff --git a/features/frontmatter_defaults.feature b/features/frontmatter_defaults.feature index 3ebfd59c..a9a64ae2 100644 --- a/features/frontmatter_defaults.feature +++ b/features/frontmatter_defaults.feature @@ -25,7 +25,7 @@ Feature: frontmatter defaults And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {custom: "some special data", author: "Ben"}}]" When I run jekyll build Then the _site directory should exist - And I should see "some special data
some special data
\ncontent for entry1.
" in "_site/index.html" - And I should see exactly "content for entry1.
" in "_site/2007/12/31/entry1.html" + And I should see "content for entry1.
" in "_site/index.html" + And I should see "content for entry1.
\n\n" in "_site/2007/12/31/entry1.html" diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 1d067f0c..d3dadd2a 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -170,8 +170,8 @@ Feature: Site configuration When I run jekyll build Then the _site directory should exist And I should see "Page Layout: 2" in "_site/index.html" - And I should see "Post Layout:content for entry1.
built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" - And I should see "Post Layout:content for entry2.
built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" + And I should see "Post Layout:content for entry1.
\n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" + And I should see "Post Layout:content for entry2.
\n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" Scenario: Generate proper dates with explicitly set timezone (different than posts' time) Given I have a _layouts directory @@ -180,19 +180,19 @@ Feature: Site configuration And I have an "index.html" page with layout "page" that contains "site index page" And I have a configuration file with: | key | value | - | timezone | Australia/Melbourne | + | timezone | Pacific/Honolulu | And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. | - | entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. | + | entry1 | 2013-04-09 23:22 +0400 | post | content for entry1. | + | entry2 | 2013-04-10 03:14 +0400 | post | content for entry2. | When I run jekyll build Then the _site directory should exist And I should see "Page Layout: 2" in "_site/index.html" - And the "_site/2013/04/10/entry1.html" file should exist - And the "_site/2013/04/10/entry2.html" file should exist - And I should see escaped "Post Layout:content for entry1.
built at 2013-04-10T13:22:00+10:00" in "_site/2013/04/10/entry1.html" - And I should see escaped "Post Layout:content for entry2.
built at 2013-04-10T17:14:00+10:00" in "_site/2013/04/10/entry2.html" + And the "_site/2013/04/09/entry1.html" file should exist + And the "_site/2013/04/09/entry2.html" file should exist + And I should see "Post Layout:content for entry1.
\n built at 2013-04-09T09:22:00-10:00" in "_site/2013/04/09/entry1.html" + And I should see "Post Layout:content for entry2.
\n built at 2013-04-09T13:14:00-10:00" in "_site/2013/04/09/entry2.html" Scenario: Limit the number of posts generated by most recent date Given I have a _posts directory diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 98f14ad1..ee4f0d37 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -8,7 +8,7 @@ def file_content_from_hash(input_hash) input_hash['content'] end - <
- Textilize -Convert a Textile-formatted string into HTML, formatted via RedCloth - |
-
-
- |
-
Markdownify diff --git a/test/helper.rb b/test/helper.rb index 132b1f62..13240e25 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -8,11 +8,9 @@ end require 'rubygems' require 'test/unit' require 'ostruct' -gem 'RedCloth', '>= 4.2.1' require 'jekyll' -require 'RedCloth' require 'rdiscount' require 'kramdown' require 'redcarpet' @@ -28,6 +26,10 @@ STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:') class Test::Unit::TestCase include RR::Adapters::TestUnit + def fixture_site(overrides = {}) + Jekyll::Site.new(site_configuration(overrides)) + end + def build_configs(overrides, base_hash = Jekyll::Configuration::DEFAULTS) Utils.deep_merge_hashes(base_hash, overrides) end diff --git a/test/source/_posts/2008-10-18-foo-bar.textile b/test/source/_posts/2008-10-18-foo-bar.markdown similarity index 52% rename from test/source/_posts/2008-10-18-foo-bar.textile rename to test/source/_posts/2008-10-18-foo-bar.markdown index 0ed8573e..3bc219aa 100644 --- a/test/source/_posts/2008-10-18-foo-bar.textile +++ b/test/source/_posts/2008-10-18-foo-bar.markdown @@ -3,6 +3,6 @@ layout: default title: Foo Bar --- -h1. {{ page.title }} +# {{ page.title }} -Best *post* ever \ No newline at end of file +Best **post** ever \ No newline at end of file diff --git a/test/source/_posts/2008-11-21-complex.textile b/test/source/_posts/2008-11-21-complex.markdown similarity index 100% rename from test/source/_posts/2008-11-21-complex.textile rename to test/source/_posts/2008-11-21-complex.markdown diff --git a/test/source/_posts/2008-12-13-include.markdown b/test/source/_posts/2008-12-13-include.markdown index 1b02ba2a..28a93539 100644 --- a/test/source/_posts/2008-12-13-include.markdown +++ b/test/source/_posts/2008-12-13-include.markdown @@ -5,4 +5,4 @@ title: Include {% include sig.markdown %} -This _is_ cool \ No newline at end of file +This _is_ cool diff --git a/test/source/_posts/2010-01-09-date-override.textile b/test/source/_posts/2010-01-09-date-override.markdown similarity index 100% rename from test/source/_posts/2010-01-09-date-override.textile rename to test/source/_posts/2010-01-09-date-override.markdown diff --git a/test/source/_posts/2010-01-09-time-override.textile b/test/source/_posts/2010-01-09-time-override.markdown similarity index 100% rename from test/source/_posts/2010-01-09-time-override.textile rename to test/source/_posts/2010-01-09-time-override.markdown diff --git a/test/source/_posts/2010-01-09-timezone-override.textile b/test/source/_posts/2010-01-09-timezone-override.markdown similarity index 100% rename from test/source/_posts/2010-01-09-timezone-override.textile rename to test/source/_posts/2010-01-09-timezone-override.markdown diff --git a/test/test_cleaner.rb b/test/test_cleaner.rb index 304ce623..74e59507 100644 --- a/test/test_cleaner.rb +++ b/test/test_cleaner.rb @@ -9,11 +9,7 @@ class TestCleaner < Test::Unit::TestCase FileUtils.touch(File.join(dest_dir('to_keep'), 'index.html')) FileUtils.touch(File.join(dest_dir('to_keep/child_dir'), 'index.html')) - @site = Site.new(Jekyll.configuration({ - "skip_config_files" => true, - "source" => source_dir, - "destination" => dest_dir - })) + @site = fixture_site @site.keep_files = ['to_keep/child_dir'] @cleaner = Site::Cleaner.new(@site) @@ -48,11 +44,7 @@ class TestCleaner < Test::Unit::TestCase FileUtils.mkdir_p(source_dir('no_files_inside/child_dir')) FileUtils.touch(File.join(source_dir('no_files_inside/child_dir'), 'index.html')) - @site = Site.new(Jekyll.configuration({ - "skip_config_files" => true, - "source" => source_dir, - "destination" => dest_dir - })) + @site = fixture_site @site.process @cleaner = Site::Cleaner.new(@site) diff --git a/test/test_coffeescript.rb b/test/test_coffeescript.rb index 91fd6237..2c589f81 100644 --- a/test/test_coffeescript.rb +++ b/test/test_coffeescript.rb @@ -3,10 +3,7 @@ require 'helper' class TestCoffeeScript < Test::Unit::TestCase context "converting CoffeeScript" do setup do - @site = Jekyll::Site.new(Jekyll.configuration({ - "source" => source_dir, - "destination" => dest_dir - })) + @site = fixture_site @site.process @test_coffeescript_file = dest_dir("js/coffeescript.js") @js_output = <<-JS diff --git a/test/test_collections.rb b/test/test_collections.rb index 118f8ddb..a119de5f 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -1,16 +1,6 @@ require 'helper' class TestCollections < Test::Unit::TestCase - - def fixture_site(overrides = {}) - Jekyll::Site.new(Jekyll.configuration( - overrides.merge({ - "source" => source_dir, - "destination" => dest_dir - }) - )) - end - context "an evil collection" do setup do @collection = Jekyll::Collection.new(fixture_site, "../../etc/password") diff --git a/test/test_filters.rb b/test/test_filters.rb index 0e18dc02..cb44b65b 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -27,10 +27,6 @@ class TestFilters < Test::Unit::TestCase ] end - should "textilize with simple string" do - assert_equal "something really simple ", @filter.textilize("something *really* simple") - end - should "markdownify with simple string" do assert_equal "something really simple \n", @filter.markdownify("something **really** simple") end diff --git a/test/test_post.rb b/test/test_post.rb index 6fdea40d..63684241 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -15,18 +15,17 @@ class TestPost < Test::Unit::TestCase context "A Post" do setup do clear_dest - @site = Site.new(Jekyll.configuration({ - "skip_config_files" => true, - "source" => source_dir, - "destination" => dest_dir - })) + @site = fixture_site end should "ensure valid posts are valid" do assert Post.valid?("2008-09-09-foo-bar.textile") assert Post.valid?("foo/bar/2008-09-09-foo-bar.textile") + assert Post.valid?("2008-09-09-foo-bar.markdown") + assert Post.valid?("foo/bar/2008-09-09-foo-bar.markdown") assert !Post.valid?("lol2008-09-09-foo-bar.textile") + assert !Post.valid?("lol2008-09-09-foo-bar.markdown") assert !Post.valid?("blah") end @@ -63,8 +62,8 @@ class TestPost < Test::Unit::TestCase @post = Post.allocate @post.site = @site - @real_file = "2008-10-18-foo-bar.textile" - @fake_file = "2008-09-09-foo-bar.textile" + @real_file = "2008-10-18-foo-bar.markdown" + @fake_file = "2008-09-09-foo-bar.markdown" @source = source_dir('_posts') end @@ -74,7 +73,7 @@ class TestPost < Test::Unit::TestCase assert_equal Time.parse("2008-09-09"), @post.date assert_equal "foo-bar", @post.slug - assert_equal ".textile", @post.ext + assert_equal ".markdown", @post.ext assert_equal "/2008/09/09", @post.dir assert_equal "/2008/09/09/foo-bar", @post.id end @@ -367,13 +366,13 @@ class TestPost < Test::Unit::TestCase @post.read_yaml(@source, @real_file) assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data) - assert_equal "h1. {{ page.title }}\n\nBest *post* ever", @post.content + assert_equal "# {{ page.title }}\n\nBest **post** ever", @post.content end should "transform textile" do @post.process(@real_file) @post.read_yaml(@source, @real_file) - assert_equal "{{ page.title }}\nBest post ever ", @post.transform + assert_equal "{{ page.title }}\n\nBest post ever ", @post.transform.strip end context "#excerpt" do @@ -461,8 +460,7 @@ class TestPost < Test::Unit::TestCase context "when in a site" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } - @site = Site.new(Jekyll.configuration) + @site = fixture_site @site.posts = [setup_post('2008-02-02-published.textile'), setup_post('2009-01-27-categories.textile')] end @@ -486,30 +484,30 @@ class TestPost < Test::Unit::TestCase context "initializing posts" do should "recognize date in yaml" do - post = setup_post("2010-01-09-date-override.textile") + post = setup_post("2010-01-09-date-override.markdown") do_render(post) assert_equal Time, post.date.class assert_equal Time, post.to_liquid["date"].class assert_equal "/2010/01/10/date-override.html", post.url - assert_equal "Post with a front matter date \n10 Jan 2010 ", post.output + assert_equal "Post with a front matter date \n\n10 Jan 2010 ", post.output.strip end should "recognize time in yaml" do - post = setup_post("2010-01-09-time-override.textile") + post = setup_post("2010-01-09-time-override.markdown") do_render(post) assert_equal Time, post.date.class assert_equal Time, post.to_liquid["date"].class assert_equal "/2010/01/10/time-override.html", post.url - assert_equal "Post with a front matter time \n10 Jan 2010 ", post.output + assert_equal "Post with a front matter time \n\n10 Jan 2010 ", post.output.strip end should "recognize time with timezone in yaml" do - post = setup_post("2010-01-09-timezone-override.textile") + post = setup_post("2010-01-09-timezone-override.markdown") do_render(post) assert_equal Time, post.date.class assert_equal Time, post.to_liquid["date"].class assert_equal "/2010/01/10/timezone-override.html", post.url - assert_equal "Post with a front matter time with timezone \n10 Jan 2010 ", post.output + assert_equal "Post with a front matter time with timezone \n\n10 Jan 2010 ", post.output.strip end should "to_liquid prioritizes post attributes over data" do @@ -603,13 +601,13 @@ class TestPost < Test::Unit::TestCase end should "render properly" do - post = setup_post("2008-10-18-foo-bar.textile") + post = setup_post("2008-10-18-foo-bar.markdown") do_render(post) - assert_equal "<<<Foo Bar\nBest post ever >>>", post.output + assert_equal "<<<Foo Bar\n\nBest post ever \n >>>", post.output end should "write properly" do - post = setup_post("2008-10-18-foo-bar.textile") + post = setup_post("2008-10-18-foo-bar.markdown") do_render(post) post.write(dest_dir) @@ -652,7 +650,7 @@ class TestPost < Test::Unit::TestCase end should "write properly without html extension" do - post = setup_post("2008-10-18-foo-bar.textile") + post = setup_post("2008-10-18-foo-bar.markdown") post.site.permalink_style = ":title/" do_render(post) post.write(dest_dir) @@ -662,32 +660,31 @@ class TestPost < Test::Unit::TestCase end should "insert data" do - post = setup_post("2008-11-21-complex.textile") + post = setup_post("2008-11-21-complex.markdown") do_render(post) - assert_equal "<<<url: /2008/11/21/complex.html url: /2008/11/21/complex.html\ndate: #{Time.parse("2008-11-21")}\nid: /2008/11/21/complex \n >>>", post.output end should "include templates" do post = setup_post("2008-12-13-include.markdown") - post.site.instance_variable_set(:@source, File.join(File.dirname(__FILE__), 'source')) do_render(post) assert_equal "<<<\n Tom Preston-Werner\ngithub.com/mojombo \n\nThis is cool \n >>>", post.output end should "render date specified in front matter properly" do - post = setup_post("2010-01-09-date-override.textile") + post = setup_post("2010-01-09-date-override.markdown") do_render(post) - assert_equal "Post with a front matter date \n10 Jan 2010 ", post.output + assert_equal "Post with a front matter date \n\n10 Jan 2010 ", post.output.strip end should "render time specified in front matter properly" do - post = setup_post("2010-01-09-time-override.textile") + post = setup_post("2010-01-09-time-override.markdown") do_render(post) - assert_equal "Post with a front matter time \n10 Jan 2010 ", post.output + assert_equal "Post with a front matter time \n\n10 Jan 2010 ", post.output.strip end end @@ -701,8 +698,7 @@ class TestPost < Test::Unit::TestCase context "converter file extension settings" do setup do - stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } - @site = Site.new(Jekyll.configuration) + @site = fixture_site end should "process .md as markdown under default configuration" do @@ -746,28 +742,17 @@ class TestPost < Test::Unit::TestCase assert conv.kind_of?(Jekyll::Converters::Identity), "The converter for .Rmd should be the Identity converter." end - should "process .text as textile under alternate configuration" do - @site.config['textile_ext'] = 'textile,text' - post = setup_post '2011-04-12-text-extension.text' - conv = post.converters.first - assert conv.kind_of? Jekyll::Converters::Textile - end - end context "site config with category" do setup do - config = site_configuration({ - 'defaults' => [ - 'scope' => { - 'path' => '' - }, - 'values' => { - 'category' => 'article' - } - ] - }) - @site = Site.new(config) + front_matter_defaults = { + 'defaults' => [{ + 'scope' => { 'path' => '' }, + 'values' => { 'category' => 'article' } + }] + } + @site = fixture_site(front_matter_defaults) end should "return category if post does not specify category" do @@ -784,17 +769,13 @@ class TestPost < Test::Unit::TestCase context "site config with categories" do setup do - config = site_configuration({ - 'defaults' => [ - 'scope' => { - 'path' => '' - }, - 'values' => { - 'categories' => ['article'] - } - ] - }) - @site = Site.new(config) + front_matter_defaults = { + 'defaults' => [{ + 'scope' => { 'path' => '' }, + 'values' => { 'categories' => ['article'] } + }] + } + @site = fixture_site(front_matter_defaults) end should "return categories if post does not specify categories" do diff --git a/test/test_redcloth.rb b/test/test_redcloth.rb deleted file mode 100644 index 964591be..00000000 --- a/test/test_redcloth.rb +++ /dev/null @@ -1,86 +0,0 @@ -require File.dirname(__FILE__) + '/helper' - -class TestRedCloth < Test::Unit::TestCase - - context "RedCloth default (no explicit config) hard_breaks enabled" do - setup do - @textile = Converters::Textile.new - end - - should "preserve single line breaks in HTML output" do - assert_equal "line1 line1 line1 line1\nline2 ", @textile.convert("p. line1\nline2").strip - end - end - - context "RedCloth w/no_span_caps set to false" do - setup do - config = { - 'redcloth' => { - 'no_span_caps' => false - } - } - @textile = Converters::Textile.new config - end - should "generate span tags around capitalized words" do - assert_equal "NSC ", @textile.convert("NSC").strip - end - end - - context "RedCloth w/no_span_caps set to true" do - setup do - config = { - 'redcloth' => { - 'no_span_caps' => true - } - } - @textile = Converters::Textile.new config - end - - should "not generate span tags around capitalized words" do - assert_equal "NSC ", @textile.convert("NSC").strip - end - end -end diff --git a/test/test_tags.rb b/test/test_tags.rb index c6df3e05..7b6b60f4 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -231,17 +231,6 @@ puts "3..2..1.." CONTENT end - context "using Textile" do - setup do - create_post(@content, {}, Jekyll::Converters::Textile) - end - - # Broken in RedCloth 4.1.9 - should "not textilize highlight block" do - assert_no_match %r{3\.\.2\.\.1\.\."}, @result - end - end - context "using Maruku" do setup do create_post(@content) |