monad 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTING.markdown +91 -0
- data/Gemfile +1 -1
- data/History.markdown +772 -0
- data/{README.md → README.markdown} +5 -2
- data/Rakefile +163 -1
- data/bin/monad +86 -30
- data/features/create_sites.feature +54 -25
- data/features/data.feature +65 -0
- data/features/data_sources.feature +10 -10
- data/features/drafts.feature +5 -5
- data/features/embed_filters.feature +10 -10
- data/features/include_tag.feature +48 -0
- data/features/markdown.feature +5 -5
- data/features/pagination.feature +38 -10
- data/features/permalinks.feature +31 -11
- data/features/post_data.feature +41 -41
- data/features/post_excerpts.feature +50 -0
- data/features/site_configuration.feature +47 -26
- data/features/site_data.feature +30 -24
- data/features/step_definitions/{monad_steps.rb → jekyll_steps.rb} +66 -52
- data/features/support/env.rb +27 -8
- data/lib/jekyll.rb +99 -0
- data/lib/jekyll/cleaner.rb +73 -0
- data/lib/{monad → jekyll}/command.rb +6 -6
- data/lib/{monad → jekyll}/commands/build.rb +9 -9
- data/lib/jekyll/commands/doctor.rb +67 -0
- data/lib/jekyll/commands/new.rb +67 -0
- data/lib/jekyll/commands/serve.rb +65 -0
- data/lib/{monad → jekyll}/configuration.rb +60 -18
- data/lib/{monad → jekyll}/converter.rb +1 -1
- data/lib/{monad → jekyll}/converters/identity.rb +1 -1
- data/lib/{monad → jekyll}/converters/markdown.rb +2 -2
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +29 -0
- data/lib/{monad → jekyll}/converters/markdown/maruku_parser.rb +12 -8
- data/lib/{monad → jekyll}/converters/markdown/rdiscount_parser.rb +4 -2
- data/lib/{monad → jekyll}/converters/markdown/redcarpet_parser.rb +1 -1
- data/lib/{monad → jekyll}/converters/textile.rb +1 -1
- data/lib/{monad → jekyll}/convertible.rb +39 -17
- data/lib/{monad → jekyll}/core_ext.rb +22 -4
- data/lib/jekyll/deprecator.rb +36 -0
- data/lib/{monad → jekyll}/draft.rb +1 -1
- data/lib/{monad → jekyll}/drivers/json_driver.rb +1 -1
- data/lib/{monad → jekyll}/drivers/yaml_driver.rb +1 -1
- data/lib/{monad → jekyll}/errors.rb +1 -1
- data/lib/jekyll/excerpt.rb +113 -0
- data/lib/{monad → jekyll}/filters.rb +16 -6
- data/lib/{monad → jekyll}/generator.rb +1 -1
- data/lib/jekyll/generators/pagination.rb +214 -0
- data/lib/{monad → jekyll}/layout.rb +4 -1
- data/lib/{monad → jekyll}/mime.types +0 -0
- data/lib/{monad → jekyll}/page.rb +36 -39
- data/lib/{monad → jekyll}/plugin.rb +1 -1
- data/lib/{monad → jekyll}/post.rb +58 -123
- data/lib/jekyll/related_posts.rb +59 -0
- data/lib/{monad → jekyll}/site.rb +120 -123
- data/lib/{monad → jekyll}/static_file.rb +1 -1
- data/lib/jekyll/stevenson.rb +89 -0
- data/lib/jekyll/tags/gist.rb +48 -0
- data/lib/{monad → jekyll}/tags/highlight.rb +3 -3
- data/lib/jekyll/tags/include.rb +135 -0
- data/lib/{monad → jekyll}/tags/post_url.rb +8 -6
- data/lib/jekyll/url.rb +67 -0
- data/lib/monad.rb +36 -27
- data/lib/site_template/_config.yml +2 -1
- data/lib/site_template/_layouts/default.html +21 -23
- data/lib/site_template/_layouts/post.html +1 -1
- data/lib/site_template/_posts/{0000-00-00-welcome-to-monad.markdown.erb → 0000-00-00-welcome-to-jekyll.markdown.erb} +6 -6
- data/lib/site_template/css/main.css +22 -27
- data/lib/site_template/index.html +2 -2
- data/monad.gemspec +153 -52
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +6 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +16 -0
- data/site/_includes/docs_contents_mobile.html +23 -0
- data/site/_includes/docs_option.html +11 -0
- data/site/_includes/docs_ul.html +20 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +18 -0
- data/site/_includes/news_contents.html +23 -0
- data/site/_includes/news_contents_mobile.html +11 -0
- data/site/_includes/news_item.html +24 -0
- data/site/_includes/primary-nav-items.html +14 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +17 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +23 -0
- data/site/_layouts/news.html +19 -0
- data/site/_layouts/news_item.html +27 -0
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
- data/site/css/gridism.css +110 -0
- data/site/css/normalize.css +1 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +946 -0
- data/site/docs/configuration.md +373 -0
- data/site/docs/contributing.md +128 -0
- data/site/docs/datafiles.md +63 -0
- data/site/docs/deployment-methods.md +109 -0
- data/site/docs/drafts.md +20 -0
- data/site/docs/extras.md +56 -0
- data/site/docs/frontmatter.md +180 -0
- data/site/docs/github-pages.md +91 -0
- data/site/docs/heroku.md +9 -0
- data/site/docs/history.md +722 -0
- data/site/docs/index.md +52 -0
- data/site/docs/installation.md +76 -0
- data/site/docs/migrations.md +257 -0
- data/site/docs/pages.md +86 -0
- data/site/docs/pagination.md +211 -0
- data/site/docs/permalinks.md +180 -0
- data/site/docs/plugins.md +508 -0
- data/site/docs/posts.md +181 -0
- data/site/docs/quickstart.md +32 -0
- data/site/docs/resources.md +46 -0
- data/site/docs/sites.md +29 -0
- data/site/docs/structure.md +190 -0
- data/site/docs/templates.md +319 -0
- data/site/docs/troubleshooting.md +150 -0
- data/site/docs/upgrading.md +146 -0
- data/site/docs/usage.md +63 -0
- data/site/docs/variables.md +322 -0
- data/site/favicon.png +0 -0
- data/site/feed.xml +36 -0
- data/site/freenode.txt +1 -0
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +90 -0
- data/site/js/modernizr-2.5.3.min.js +4 -0
- data/site/news/index.html +10 -0
- data/site/news/releases/index.html +10 -0
- data/test/helper.rb +6 -3
- data/test/source/+/foo.md +7 -0
- data/test/source/_data/languages.yml +2 -0
- data/test/source/_data/members.yaml +7 -0
- data/test/source/_data/products.yml +4 -0
- data/test/source/_includes/params.html +7 -0
- data/test/source/_layouts/default.html +1 -1
- data/test/source/_layouts/post/simple.html +1 -0
- data/test/source/_plugins/dummy.rb +1 -1
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +1 -1
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/deal.with.dots.html +1 -1
- data/test/source/products.yml +4 -0
- data/test/test_configuration.rb +46 -11
- data/test/test_convertible.rb +2 -2
- data/test/test_excerpt.rb +78 -0
- data/test/test_filters.rb +4 -4
- data/test/test_generated_site.rb +13 -13
- data/test/test_json_driver.rb +9 -9
- data/test/test_kramdown.rb +32 -5
- data/test/test_new_command.rb +8 -8
- data/test/test_page.rb +12 -3
- data/test/test_pager.rb +34 -33
- data/test/test_post.rb +34 -26
- data/test/test_redcloth.rb +3 -3
- data/test/test_related_posts.rb +47 -0
- data/test/test_site.rb +102 -44
- data/test/test_tags.rb +168 -23
- data/test/test_url.rb +28 -0
- data/test/test_yaml_driver.rb +6 -6
- metadata +215 -137
- data/lib/monad/commands/doctor.rb +0 -29
- data/lib/monad/commands/new.rb +0 -50
- data/lib/monad/commands/serve.rb +0 -33
- data/lib/monad/converters/markdown/kramdown_parser.rb +0 -44
- data/lib/monad/deprecator.rb +0 -32
- data/lib/monad/generators/pagination.rb +0 -143
- data/lib/monad/logger.rb +0 -54
- data/lib/monad/tags/gist.rb +0 -30
- data/lib/monad/tags/include.rb +0 -37
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestExcerpt < Test::Unit::TestCase
|
|
4
|
+
def setup_post(file)
|
|
5
|
+
Post.new(@site, source_dir, '', file)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def do_render(post)
|
|
9
|
+
layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
|
|
10
|
+
post.render(layouts, {"site" => {"posts" => []}})
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context "With extraction disabled" do
|
|
14
|
+
setup do
|
|
15
|
+
clear_dest
|
|
16
|
+
stub(Jekyll).configuration do
|
|
17
|
+
Jekyll::Configuration::DEFAULTS.merge({'excerpt_separator' => ''})
|
|
18
|
+
end
|
|
19
|
+
@site = Site.new(Jekyll.configuration)
|
|
20
|
+
@post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should "not be generated" do
|
|
24
|
+
excerpt = @post.send(:extract_excerpt)
|
|
25
|
+
assert_equal true, excerpt.empty?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context "An extracted excerpt" do
|
|
30
|
+
setup do
|
|
31
|
+
clear_dest
|
|
32
|
+
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
|
33
|
+
@site = Site.new(Jekyll.configuration)
|
|
34
|
+
@post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
|
|
35
|
+
@excerpt = @post.send :extract_excerpt
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "#to_liquid" do
|
|
39
|
+
should "contain the proper page data to mimick the post liquid" do
|
|
40
|
+
assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"]
|
|
41
|
+
assert_equal "/bar/baz/z_category/2013/07/22/post-excerpt-with-layout.html", @excerpt.to_liquid["url"]
|
|
42
|
+
assert_equal Time.parse("2013-07-22"), @excerpt.to_liquid["date"]
|
|
43
|
+
assert_equal %w[bar baz z_category], @excerpt.to_liquid["categories"]
|
|
44
|
+
assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"]
|
|
45
|
+
assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context "#content" do
|
|
50
|
+
|
|
51
|
+
context "before render" do
|
|
52
|
+
should "be the first paragraph of the page" do
|
|
53
|
+
assert_equal "First paragraph with [link ref][link].\n\n[link]: http://www.jekyllrb.com/", @excerpt.content
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
should "contain any refs at the bottom of the page" do
|
|
57
|
+
assert @excerpt.content.include?("[link]: http://www.jekyllrb.com/")
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context "after render" do
|
|
62
|
+
setup do
|
|
63
|
+
@rendered_post = @post.dup
|
|
64
|
+
do_render(@rendered_post)
|
|
65
|
+
@extracted_excerpt = @rendered_post.send :extracted_excerpt
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
should "be the first paragraph of the page" do
|
|
69
|
+
assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>", @extracted_excerpt.content
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
should "link properly" do
|
|
73
|
+
assert @extracted_excerpt.content.include?("http://www.jekyllrb.com/")
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
data/test/test_filters.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
require 'helper'
|
|
2
2
|
|
|
3
3
|
class TestFilters < Test::Unit::TestCase
|
|
4
|
-
class
|
|
5
|
-
include
|
|
4
|
+
class JekyllFilter
|
|
5
|
+
include Jekyll::Filters
|
|
6
6
|
|
|
7
7
|
def initialize
|
|
8
|
-
site =
|
|
8
|
+
site = Jekyll::Site.new(Jekyll.configuration({}))
|
|
9
9
|
@context = Liquid::Context.new({}, {}, { :site => site })
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
context "filters" do
|
|
14
14
|
setup do
|
|
15
|
-
@filter =
|
|
15
|
+
@filter = JekyllFilter.new
|
|
16
16
|
@sample_time = Time.utc(2013, 03, 27, 11, 22, 33)
|
|
17
17
|
@time_as_string = "September 11, 2001 12:46:30 -0000"
|
|
18
18
|
end
|
data/test/test_generated_site.rb
CHANGED
|
@@ -4,17 +4,17 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|
|
4
4
|
context "generated sites" do
|
|
5
5
|
setup do
|
|
6
6
|
clear_dest
|
|
7
|
-
stub(
|
|
8
|
-
|
|
7
|
+
stub(Jekyll).configuration do
|
|
8
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
@site = Site.new(
|
|
11
|
+
@site = Site.new(Jekyll.configuration)
|
|
12
12
|
@site.process
|
|
13
13
|
@index = File.read(dest_dir('index.html'))
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
should "ensure post count is as expected" do
|
|
17
|
-
assert_equal
|
|
17
|
+
assert_equal 36, @site.posts.size
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
should "insert site.posts into the index" do
|
|
@@ -45,11 +45,11 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|
|
45
45
|
context "generating limited posts" do
|
|
46
46
|
setup do
|
|
47
47
|
clear_dest
|
|
48
|
-
stub(
|
|
49
|
-
|
|
48
|
+
stub(Jekyll).configuration do
|
|
49
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5})
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
@site = Site.new(
|
|
52
|
+
@site = Site.new(Jekyll.configuration)
|
|
53
53
|
@site.process
|
|
54
54
|
@index = File.read(dest_dir('index.html'))
|
|
55
55
|
end
|
|
@@ -61,22 +61,22 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|
|
61
61
|
should "ensure limit posts is 0 or more" do
|
|
62
62
|
assert_raise ArgumentError do
|
|
63
63
|
clear_dest
|
|
64
|
-
stub(
|
|
65
|
-
|
|
64
|
+
stub(Jekyll).configuration do
|
|
65
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1})
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
@site = Site.new(
|
|
68
|
+
@site = Site.new(Jekyll.configuration)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
should "acceptable limit post is 0" do
|
|
73
73
|
assert_nothing_raised ArgumentError do
|
|
74
74
|
clear_dest
|
|
75
|
-
stub(
|
|
76
|
-
|
|
75
|
+
stub(Jekyll).configuration do
|
|
76
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0})
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
@site = Site.new(
|
|
79
|
+
@site = Site.new(Jekyll.configuration)
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
end
|
data/test/test_json_driver.rb
CHANGED
|
@@ -5,25 +5,25 @@ class TestJsonDriver < Test::Unit::TestCase
|
|
|
5
5
|
context 'incorrect input' do
|
|
6
6
|
should 'throw exception if url option is not parsed in' do
|
|
7
7
|
assert_raise FatalException do
|
|
8
|
-
|
|
8
|
+
Jekyll::Drivers::JsonDriver.new({})
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
should 'throw exception if url option is nil' do
|
|
13
|
-
assert_raise
|
|
14
|
-
|
|
13
|
+
assert_raise Jekyll::FatalException do
|
|
14
|
+
Jekyll::Drivers::JsonDriver.new('url' => nil)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
should 'throw exception if parsed in url is invalid' do
|
|
19
19
|
assert_raise FatalException do
|
|
20
|
-
json_driver =
|
|
20
|
+
json_driver = Jekyll::Drivers::JsonDriver.new('url' => 'abc.com')
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
should 'throw exception if parsed in url is not http' do
|
|
25
25
|
assert_raise FatalException do
|
|
26
|
-
json_driver =
|
|
26
|
+
json_driver = Jekyll::Drivers::JsonDriver.new('url' => 'ftp://abc.com')
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -31,14 +31,14 @@ class TestJsonDriver < Test::Unit::TestCase
|
|
|
31
31
|
context 'incorrect environment' do
|
|
32
32
|
should 'throw exception if server does not respond' do
|
|
33
33
|
assert_raise Errno::ECONNREFUSED do
|
|
34
|
-
|
|
34
|
+
Jekyll::Drivers::JsonDriver.new('url' => 'http://127.0.0.1:1').load
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
should 'throw exception if server returns non-json content' do
|
|
39
39
|
assert_raise JSON::ParserError do
|
|
40
40
|
stub_http_request(:get, 'http://test.com/').to_return(body: 'hello, world')
|
|
41
|
-
|
|
41
|
+
Jekyll::Drivers::JsonDriver.new('url' => 'http://test.com/').load
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -48,7 +48,7 @@ class TestJsonDriver < Test::Unit::TestCase
|
|
|
48
48
|
assert_nothing_raised do
|
|
49
49
|
stub_http_request(:get, 'http://test.com/').to_return(body: '{"ip": "127.0.0.1"}')
|
|
50
50
|
|
|
51
|
-
data =
|
|
51
|
+
data = Jekyll::Drivers::JsonDriver.new('url' => 'http://test.com/').load
|
|
52
52
|
assert_equal data['ip'], '127.0.0.1'
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -57,7 +57,7 @@ class TestJsonDriver < Test::Unit::TestCase
|
|
|
57
57
|
assert_nothing_raised do
|
|
58
58
|
stub_http_request(:get, 'https://test.com/').to_return(body: '{"city": "Nanjing"}')
|
|
59
59
|
|
|
60
|
-
data =
|
|
60
|
+
data = Jekyll::Drivers::JsonDriver.new('url' => 'https://test.com/').load
|
|
61
61
|
assert_equal data['city'], 'Nanjing'
|
|
62
62
|
end
|
|
63
63
|
end
|
data/test/test_kramdown.rb
CHANGED
|
@@ -12,24 +12,51 @@ class TestKramdown < Test::Unit::TestCase
|
|
|
12
12
|
'footnote_nr' => 1,
|
|
13
13
|
'entity_output' => 'as_char',
|
|
14
14
|
'toc_levels' => '1..6',
|
|
15
|
-
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo'
|
|
15
|
+
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
|
|
16
|
+
|
|
17
|
+
'use_coderay' => true,
|
|
18
|
+
'coderay_bold_every'=> 12,
|
|
19
|
+
'coderay' => {
|
|
20
|
+
'coderay_css' => :style,
|
|
21
|
+
'coderay_bold_every' => 8
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
}
|
|
25
|
+
@config = Jekyll.configuration(@config)
|
|
26
|
+
@markdown = Converters::Markdown.new(@config)
|
|
18
27
|
end
|
|
19
28
|
|
|
20
29
|
# http://kramdown.rubyforge.org/converter/html.html#options
|
|
21
30
|
should "pass kramdown options" do
|
|
22
|
-
|
|
23
|
-
assert_equal "<h1>Some Header</h1>", markdown.convert('# Some Header #').strip
|
|
31
|
+
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
|
|
24
32
|
end
|
|
25
33
|
|
|
26
34
|
should "convert quotes to smart quotes" do
|
|
27
|
-
|
|
28
|
-
assert_match /<p>(“|“)Pit(’|’)hy(”|”)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
|
|
35
|
+
assert_match /<p>(“|“)Pit(’|’)hy(”|”)<\/p>/, @markdown.convert(%{"Pit'hy"}).strip
|
|
29
36
|
|
|
30
37
|
override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } }
|
|
31
38
|
markdown = Converters::Markdown.new(@config.deep_merge(override))
|
|
32
39
|
assert_match /<p>(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
|
|
33
40
|
end
|
|
41
|
+
|
|
42
|
+
context "moving up nested coderay options" do
|
|
43
|
+
setup do
|
|
44
|
+
@markdown.convert('some markup')
|
|
45
|
+
@converter_config = @markdown.instance_variable_get(:@config)['kramdown']
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
should "work correctly" do
|
|
49
|
+
assert_equal :style, @converter_config['coderay_css']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
should "also work for defaults" do
|
|
53
|
+
default = Jekyll::Configuration::DEFAULTS['kramdown']['coderay']['coderay_tab_width']
|
|
54
|
+
assert_equal default, @converter_config['coderay_tab_width']
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
should "not overwrite" do
|
|
58
|
+
assert_equal 12, @converter_config['coderay_bold_every']
|
|
59
|
+
end
|
|
60
|
+
end
|
|
34
61
|
end
|
|
35
62
|
end
|
data/test/test_new_command.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require 'helper'
|
|
2
|
-
require '
|
|
2
|
+
require 'jekyll/commands/new'
|
|
3
3
|
|
|
4
4
|
class TestNewCommand < Test::Unit::TestCase
|
|
5
5
|
def dir_contents(path)
|
|
@@ -25,13 +25,13 @@ class TestNewCommand < Test::Unit::TestCase
|
|
|
25
25
|
|
|
26
26
|
should 'create a new directory' do
|
|
27
27
|
assert !File.exists?(@full_path)
|
|
28
|
-
capture_stdout {
|
|
28
|
+
capture_stdout { Jekyll::Commands::New.process(@args) }
|
|
29
29
|
assert File.exists?(@full_path)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
should 'display a success message' do
|
|
33
|
-
output = capture_stdout {
|
|
34
|
-
success_message = "New
|
|
33
|
+
output = capture_stdout { Jekyll::Commands::New.process(@args) }
|
|
34
|
+
success_message = "New jekyll site installed in #{@full_path}.\n"
|
|
35
35
|
assert_equal success_message, output
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ class TestNewCommand < Test::Unit::TestCase
|
|
|
40
40
|
File.extname(f) == '.erb'
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
capture_stdout {
|
|
43
|
+
capture_stdout { Jekyll::Commands::New.process(@args) }
|
|
44
44
|
|
|
45
45
|
new_site_files = dir_contents(@full_path).reject do |f|
|
|
46
46
|
File.extname(f) == '.markdown'
|
|
@@ -62,7 +62,7 @@ class TestNewCommand < Test::Unit::TestCase
|
|
|
62
62
|
f.gsub! '0000-00-00', stubbed_date
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
capture_stdout {
|
|
65
|
+
capture_stdout { Jekyll::Commands::New.process(@args) }
|
|
66
66
|
|
|
67
67
|
new_site_files = dir_contents(@full_path).select do |f|
|
|
68
68
|
erb_template_files.include? f
|
|
@@ -84,7 +84,7 @@ class TestNewCommand < Test::Unit::TestCase
|
|
|
84
84
|
|
|
85
85
|
should 'create a new directory' do
|
|
86
86
|
assert !File.exists?(@site_name_with_spaces)
|
|
87
|
-
capture_stdout {
|
|
87
|
+
capture_stdout { Jekyll::Commands::New.process(@multiple_args) }
|
|
88
88
|
assert File.exists?(@site_name_with_spaces)
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -96,7 +96,7 @@ class TestNewCommand < Test::Unit::TestCase
|
|
|
96
96
|
|
|
97
97
|
should 'raise an ArgumentError' do
|
|
98
98
|
exception = assert_raise ArgumentError do
|
|
99
|
-
|
|
99
|
+
Jekyll::Commands::New.process(@empty_args)
|
|
100
100
|
end
|
|
101
101
|
assert_equal 'You must specify a path.', exception.message
|
|
102
102
|
end
|
data/test/test_page.rb
CHANGED
|
@@ -15,8 +15,8 @@ class TestPage < Test::Unit::TestCase
|
|
|
15
15
|
context "A Page" do
|
|
16
16
|
setup do
|
|
17
17
|
clear_dest
|
|
18
|
-
stub(
|
|
19
|
-
@site = Site.new(
|
|
18
|
+
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
|
19
|
+
@site = Site.new(Jekyll.configuration)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
context "processing pages" do
|
|
@@ -102,7 +102,7 @@ class TestPage < Test::Unit::TestCase
|
|
|
102
102
|
assert_equal "/about/", @page.dir
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
context "with specified layout of nil" do
|
|
107
107
|
setup do
|
|
108
108
|
@page = setup_page('sitemap.xml')
|
|
@@ -127,6 +127,15 @@ class TestPage < Test::Unit::TestCase
|
|
|
127
127
|
assert File.exists?(File.join(dest_dir, 'contacts.html'))
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
+
should "write even when the folder name is plus and permalink has +" do
|
|
131
|
+
page = setup_page('+', 'foo.md')
|
|
132
|
+
do_render(page)
|
|
133
|
+
page.write(dest_dir)
|
|
134
|
+
|
|
135
|
+
assert File.directory?(dest_dir)
|
|
136
|
+
assert File.exists?(File.join(dest_dir, '+', 'plus+in+url'))
|
|
137
|
+
end
|
|
138
|
+
|
|
130
139
|
should "write properly without html extension" do
|
|
131
140
|
page = setup_page('contacts.html')
|
|
132
141
|
page.site.permalink_style = :pretty
|
data/test/test_pager.rb
CHANGED
|
@@ -2,6 +2,17 @@ require 'helper'
|
|
|
2
2
|
|
|
3
3
|
class TestPager < Test::Unit::TestCase
|
|
4
4
|
|
|
5
|
+
def build_site(config = {})
|
|
6
|
+
base = Jekyll::Configuration::DEFAULTS.deep_merge({
|
|
7
|
+
'source' => source_dir,
|
|
8
|
+
'destination' => dest_dir,
|
|
9
|
+
'paginate' => 1
|
|
10
|
+
})
|
|
11
|
+
site = Jekyll::Site.new(base.deep_merge(config))
|
|
12
|
+
site.process
|
|
13
|
+
site
|
|
14
|
+
end
|
|
15
|
+
|
|
5
16
|
should "calculate number of pages" do
|
|
6
17
|
assert_equal(0, Pager.calculate_pages([], '2'))
|
|
7
18
|
assert_equal(1, Pager.calculate_pages([1], '2'))
|
|
@@ -11,43 +22,33 @@ class TestPager < Test::Unit::TestCase
|
|
|
11
22
|
assert_equal(3, Pager.calculate_pages([1,2,3,4,5], '2'))
|
|
12
23
|
end
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
should "determine the pagination path" do
|
|
26
|
+
assert_equal("/index.html", Pager.paginate_path(build_site, 1))
|
|
27
|
+
assert_equal("/page2", Pager.paginate_path(build_site, 2))
|
|
28
|
+
assert_equal("/index.html", Pager.paginate_path(build_site({'paginate_path' => '/blog/page-:num'}), 1))
|
|
29
|
+
assert_equal("/blog/page-2", Pager.paginate_path(build_site({'paginate_path' => '/blog/page-:num'}), 2))
|
|
30
|
+
assert_equal("/index.html", Pager.paginate_path(build_site({'paginate_path' => '/blog/page/:num'}), 1))
|
|
31
|
+
assert_equal("/blog/page/2", Pager.paginate_path(build_site({'paginate_path' => '/blog/page/:num'}), 2))
|
|
32
|
+
assert_equal("/contacts/index.html", Pager.paginate_path(build_site({'paginate_path' => '/contacts/page:num'}), 1))
|
|
33
|
+
assert_equal("/contacts/page2", Pager.paginate_path(build_site({'paginate_path' => '/contacts/page:num'}), 2))
|
|
34
|
+
assert_equal("/contacts/index.html", Pager.paginate_path(build_site({'paginate_path' => '/contacts/page/:num'}), 1))
|
|
35
|
+
assert_equal("/contacts/page/2", Pager.paginate_path(build_site({'paginate_path' => '/contacts/page/:num'}), 2))
|
|
36
|
+
end
|
|
24
37
|
|
|
38
|
+
context "pagination disabled" do
|
|
25
39
|
should "report that pagination is disabled" do
|
|
26
|
-
|
|
27
|
-
assert !Pager.pagination_enabled?(@config, page)
|
|
40
|
+
assert !Pager.pagination_enabled?(build_site('paginate' => nil))
|
|
28
41
|
end
|
|
29
|
-
|
|
30
42
|
end
|
|
31
43
|
|
|
32
44
|
context "pagination enabled for 2" do
|
|
33
45
|
setup do
|
|
34
|
-
|
|
35
|
-
Monad::Configuration::DEFAULTS.merge({
|
|
36
|
-
'source' => source_dir,
|
|
37
|
-
'destination' => dest_dir,
|
|
38
|
-
'paginate' => 2
|
|
39
|
-
})
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
@config = Monad.configuration
|
|
43
|
-
@site = Site.new(@config)
|
|
44
|
-
@site.process
|
|
46
|
+
@site = build_site('paginate' => 2)
|
|
45
47
|
@posts = @site.posts
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
should "report that pagination is enabled" do
|
|
49
|
-
|
|
50
|
-
assert Pager.pagination_enabled?(@config, page)
|
|
51
|
+
assert Pager.pagination_enabled?(@site)
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
context "with 4 posts" do
|
|
@@ -56,7 +57,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
should "create first pager" do
|
|
59
|
-
pager = Pager.new(@
|
|
60
|
+
pager = Pager.new(@site, 1, @posts)
|
|
60
61
|
assert_equal(2, pager.posts.size)
|
|
61
62
|
assert_equal(2, pager.total_pages)
|
|
62
63
|
assert_nil(pager.previous_page)
|
|
@@ -64,7 +65,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
should "create second pager" do
|
|
67
|
-
pager = Pager.new(@
|
|
68
|
+
pager = Pager.new(@site, 2, @posts)
|
|
68
69
|
assert_equal(2, pager.posts.size)
|
|
69
70
|
assert_equal(2, pager.total_pages)
|
|
70
71
|
assert_equal(1, pager.previous_page)
|
|
@@ -72,7 +73,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
should "not create third pager" do
|
|
75
|
-
assert_raise(RuntimeError) { Pager.new(@
|
|
76
|
+
assert_raise(RuntimeError) { Pager.new(@site, 3, @posts) }
|
|
76
77
|
end
|
|
77
78
|
|
|
78
79
|
end
|
|
@@ -83,7 +84,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
should "create first pager" do
|
|
86
|
-
pager = Pager.new(@
|
|
87
|
+
pager = Pager.new(@site, 1, @posts)
|
|
87
88
|
assert_equal(2, pager.posts.size)
|
|
88
89
|
assert_equal(3, pager.total_pages)
|
|
89
90
|
assert_nil(pager.previous_page)
|
|
@@ -91,7 +92,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
should "create second pager" do
|
|
94
|
-
pager = Pager.new(@
|
|
95
|
+
pager = Pager.new(@site, 2, @posts)
|
|
95
96
|
assert_equal(2, pager.posts.size)
|
|
96
97
|
assert_equal(3, pager.total_pages)
|
|
97
98
|
assert_equal(1, pager.previous_page)
|
|
@@ -99,7 +100,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
99
100
|
end
|
|
100
101
|
|
|
101
102
|
should "create third pager" do
|
|
102
|
-
pager = Pager.new(@
|
|
103
|
+
pager = Pager.new(@site, 3, @posts)
|
|
103
104
|
assert_equal(1, pager.posts.size)
|
|
104
105
|
assert_equal(3, pager.total_pages)
|
|
105
106
|
assert_equal(2, pager.previous_page)
|
|
@@ -107,7 +108,7 @@ class TestPager < Test::Unit::TestCase
|
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
should "not create fourth pager" do
|
|
110
|
-
assert_raise(RuntimeError) { Pager.new(@
|
|
111
|
+
assert_raise(RuntimeError) { Pager.new(@site, 4, @posts) }
|
|
111
112
|
end
|
|
112
113
|
|
|
113
114
|
end
|