jekyll 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

Files changed (90) hide show
  1. checksums.yaml +14 -6
  2. data/{CONTRIBUTING.md → CONTRIBUTING.markdown} +19 -1
  3. data/History.markdown +172 -85
  4. data/README.markdown +45 -0
  5. data/Rakefile +43 -18
  6. data/bin/jekyll +31 -1
  7. data/features/create_sites.feature +18 -0
  8. data/features/include_tag.feature +35 -0
  9. data/features/pagination.feature +28 -0
  10. data/features/post_excerpts.feature +50 -0
  11. data/features/step_definitions/jekyll_steps.rb +27 -11
  12. data/features/support/env.rb +9 -0
  13. data/jekyll.gemspec +32 -7
  14. data/lib/jekyll.rb +2 -1
  15. data/lib/jekyll/commands/new.rb +15 -3
  16. data/lib/jekyll/configuration.rb +23 -22
  17. data/lib/jekyll/converters/markdown/kramdown_parser.rb +4 -15
  18. data/lib/jekyll/convertible.rb +4 -0
  19. data/lib/jekyll/core_ext.rb +11 -0
  20. data/lib/jekyll/excerpt.rb +113 -0
  21. data/lib/jekyll/generators/pagination.rb +93 -23
  22. data/lib/jekyll/page.rb +1 -3
  23. data/lib/jekyll/post.rb +15 -55
  24. data/lib/jekyll/related_posts.rb +2 -1
  25. data/lib/jekyll/site.rb +33 -41
  26. data/lib/jekyll/stevenson.rb +25 -4
  27. data/lib/jekyll/tags/include.rb +46 -2
  28. data/lib/site_template/_config.yml +1 -0
  29. data/lib/site_template/css/main.css +0 -5
  30. data/site/_config.yml +1 -0
  31. data/site/_includes/docs_contents.html +12 -3
  32. data/site/_includes/docs_contents_mobile.html +7 -1
  33. data/site/_includes/news_contents.html +23 -0
  34. data/site/_includes/news_contents_mobile.html +11 -0
  35. data/site/_includes/news_item.html +24 -0
  36. data/site/_includes/primary-nav-items.html +4 -1
  37. data/site/_includes/top.html +2 -0
  38. data/site/_layouts/news.html +19 -0
  39. data/site/_layouts/news_item.html +27 -0
  40. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
  41. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
  42. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
  43. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
  44. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
  45. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
  46. data/site/css/style.css +125 -17
  47. data/site/docs/configuration.md +10 -1
  48. data/site/docs/contributing.md +21 -3
  49. data/site/docs/deployment-methods.md +2 -2
  50. data/site/docs/drafts.md +20 -0
  51. data/site/docs/extras.md +24 -3
  52. data/site/docs/github-pages.md +25 -0
  53. data/site/docs/history.md +150 -85
  54. data/site/docs/index.md +1 -17
  55. data/site/docs/installation.md +3 -2
  56. data/site/docs/migrations.md +2 -2
  57. data/site/docs/pagination.md +12 -0
  58. data/site/docs/plugins.md +97 -76
  59. data/site/docs/quickstart.md +32 -0
  60. data/site/docs/resources.md +0 -1
  61. data/site/docs/structure.md +15 -0
  62. data/site/docs/templates.md +26 -4
  63. data/site/docs/troubleshooting.md +22 -7
  64. data/site/docs/upgrading.md +6 -1
  65. data/site/docs/variables.md +12 -2
  66. data/site/feed.xml +36 -0
  67. data/site/freenode.txt +1 -0
  68. data/site/img/article-footer.png +0 -0
  69. data/site/img/footer-arrow.png +0 -0
  70. data/site/img/footer-logo.png +0 -0
  71. data/site/img/logo-2x.png +0 -0
  72. data/site/img/octojekyll.png +0 -0
  73. data/site/img/tube.png +0 -0
  74. data/site/img/tube1x.png +0 -0
  75. data/site/index.html +1 -1
  76. data/site/news/index.md +10 -0
  77. data/site/news/releases/index.md +10 -0
  78. data/test/source/+/foo.md +7 -0
  79. data/test/source/_includes/params.html +7 -0
  80. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
  81. data/test/test_configuration.rb +9 -0
  82. data/test/test_excerpt.rb +62 -0
  83. data/test/test_generated_site.rb +1 -1
  84. data/test/test_page.rb +9 -0
  85. data/test/test_pager.rb +31 -37
  86. data/test/test_post.rb +2 -1
  87. data/test/test_related_posts.rb +6 -1
  88. data/test/test_tags.rb +90 -0
  89. metadata +62 -23
  90. data/README.textile +0 -45
@@ -2,13 +2,18 @@
2
2
  layout: docs
3
3
  title: Upgrading
4
4
  prev_section: resources
5
- next_section: history
5
+ next_section: contributing
6
6
  permalink: /docs/upgrading/
7
7
  ---
8
8
 
9
9
  Upgrading from an older version of Jekyll? A few things have changed in 1.0
10
10
  that you'll want to know about.
11
11
 
12
+ Before we dive in, go ahead and fetch the latest version of Jekyll:
13
+
14
+ {% highlight bash %}
15
+ $ gem update jekyll
16
+ {% endhighlight %}
12
17
 
13
18
  <div class="note feature">
14
19
  <h5 markdown="1">Diving in</h5>
@@ -84,6 +84,14 @@ following is a reference of the available data.
84
84
 
85
85
  </p></td>
86
86
  </tr>
87
+ <tr>
88
+ <td><p><code>site.pages</code></p></td>
89
+ <td><p>
90
+
91
+ A list of all Pages.
92
+
93
+ </p></td>
94
+ </tr>
87
95
  <tr>
88
96
  <td><p><code>site.posts</code></p></td>
89
97
  <td><p>
@@ -161,7 +169,7 @@ following is a reference of the available data.
161
169
  <td><p><code>page.title</code></p></td>
162
170
  <td><p>
163
171
 
164
- The title of the Post.
172
+ The title of the Page.
165
173
 
166
174
  </p></td>
167
175
  </tr>
@@ -189,7 +197,9 @@ following is a reference of the available data.
189
197
 
190
198
  The Date assigned to the Post. This can be overridden in a Post’s front
191
199
  matter by specifying a new date/time in the format
192
- <code>YYYY-MM-DD HH:MM:SS</code>
200
+ <code>YYYY-MM-DD HH:MM:SS</code> (assuming UTC), or
201
+ <code>YYYY-MM-DD HH:MM:SS +/-TTTT</code> (to specify a time zone using
202
+ an offset from UTC. e.g. <code>2008-12-14 10:30:00 +0900</code>).
193
203
 
194
204
  </p></td>
195
205
  </tr>
@@ -0,0 +1,36 @@
1
+ ---
2
+ layout: none
3
+ permalink: /feed.xml
4
+ ---
5
+
6
+ <?xml version="1.0" encoding="utf-8"?>
7
+ <rss version="2.0"
8
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
9
+ xmlns:wfw="http://wellformedweb.org/CommentAPI/"
10
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
11
+ xmlns:atom="http://www.w3.org/2005/Atom"
12
+ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
13
+ xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
14
+ >
15
+ <channel>
16
+ <title xml:lang="en">Jekyll • Simple, blog-aware, static sites</title>
17
+ <atom:link type="application/atom+xml" href="http://jekyllrb.com/feed/" rel="self"/>
18
+ <link>http://jekyllrb.com</link>
19
+ <pubDate>{{ site.time | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
20
+ <lastBuildDate>{{ site.time | date: "%a, %d %b %Y %H:%M:%S %z" }}</lastBuildDate>
21
+ <language>en-US</language>
22
+ <description>Transform your plain text into static websites and blogs.</description>
23
+ {% for post in site.posts %}
24
+ <item>
25
+ <title>{{ post.title }}</title>
26
+ <link>http://jekyllrb.com{{ post.url }}</link>
27
+ <pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
28
+ <dc:creator>{{ post.author }}</dc:creator>
29
+ {% for tag in post.tags %}<category>{{ tag | xml_escape }}</category>
30
+ {% endfor %}{% for cat in post.categories %}<category>{{ cat | xml_escape }}</category>
31
+ {% endfor %}<guid isPermaLink="false">{{ post.id }}</guid>
32
+ <description><![CDATA[ {{ post.content }} ]]></description>
33
+ </item>
34
+ {% endfor %}
35
+ </channel>
36
+ </rss>
@@ -0,0 +1 @@
1
+ aS3gAc4g
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  layout: default
3
- title: Jekyll Simple, blog-aware, static sites
3
+ title: Jekyll &bull; Simple, blog-aware, static sites
4
4
  overview: true
5
5
  ---
6
6
 
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: news
3
+ title: News
4
+ permalink: /news/
5
+ author: all
6
+ ---
7
+
8
+ {% for post in site.posts %}
9
+ {% include news_item.html %}
10
+ {% endfor %}
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: news
3
+ title: Releases
4
+ permalink: /news/releases/
5
+ author: all
6
+ ---
7
+
8
+ {% for post in site.categories.release %}
9
+ {% include news_item.html %}
10
+ {% endfor %}
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title : Page inside +
4
+ permalink: plus+in+url
5
+ ---
6
+ Line 1
7
+ {{ page.title }}
@@ -0,0 +1,7 @@
1
+ <span id='include-param'>{{include.param}}</span>
2
+
3
+ <ul id='param-list'>
4
+ {% for param in include %}
5
+ <li>{{param[0]}} = {{param[1]}}</li>
6
+ {% endfor %}
7
+ </ul>
@@ -0,0 +1,23 @@
1
+ ---
2
+ layout: post
3
+ title: Post Excerpt with Layout
4
+ categories:
5
+ - bar
6
+ - baz
7
+ - z_category
8
+ tags:
9
+ - first
10
+ - second
11
+ - third
12
+ - jekyllrb.com
13
+ ---
14
+
15
+ First paragraph with [link ref][link].
16
+
17
+ Second paragraph
18
+
19
+ ---
20
+
21
+ Third paragraph
22
+
23
+ [link]: http://www.jekyllrb.com/
@@ -82,6 +82,7 @@ class TestConfiguration < Test::Unit::TestCase
82
82
  context "loading configuration" do
83
83
  setup do
84
84
  @path = File.join(Dir.pwd, '_config.yml')
85
+ @user_config = File.join(Dir.pwd, "my_config_file.yml")
85
86
  end
86
87
 
87
88
  should "fire warning with no _config.yml" do
@@ -102,6 +103,14 @@ class TestConfiguration < Test::Unit::TestCase
102
103
  mock($stderr).puts("Configuration file: (INVALID) #{@path}".yellow)
103
104
  assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
104
105
  end
106
+
107
+ should "fire warning when user-specified config file isn't there" do
108
+ mock(YAML).safe_load_file(@user_config) { raise SystemCallError, "No such file or directory - #{@user_config}" }
109
+ mock($stderr).puts(("Fatal: ".rjust(20) + "The configuration file '#{@user_config}' could not be found.").red)
110
+ assert_raises LoadError do
111
+ Jekyll.configuration({'config' => [@user_config]})
112
+ end
113
+ end
105
114
  end
106
115
  context "loading config from external file" do
107
116
  setup do
@@ -0,0 +1,62 @@
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 "An extracted excerpt" do
14
+ setup do
15
+ clear_dest
16
+ stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
17
+ @site = Site.new(Jekyll.configuration)
18
+ @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
19
+ @excerpt = @post.send :extract_excerpt
20
+ end
21
+
22
+ context "#to_liquid" do
23
+ should "contain the proper page data to mimick the post liquid" do
24
+ assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"]
25
+ assert_equal "/bar/baz/z_category/2013/07/22/post-excerpt-with-layout.html", @excerpt.to_liquid["url"]
26
+ assert_equal Time.parse("2013-07-22"), @excerpt.to_liquid["date"]
27
+ assert_equal %w[bar baz z_category], @excerpt.to_liquid["categories"]
28
+ assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"]
29
+ assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"]
30
+ end
31
+ end
32
+
33
+ context "#content" do
34
+
35
+ context "before render" do
36
+ should "be the first paragraph of the page" do
37
+ assert_equal "First paragraph with [link ref][link].\n\n[link]: http://www.jekyllrb.com/", @excerpt.content
38
+ end
39
+
40
+ should "contain any refs at the bottom of the page" do
41
+ assert @excerpt.content.include?("[link]: http://www.jekyllrb.com/")
42
+ end
43
+ end
44
+
45
+ context "after render" do
46
+ setup do
47
+ @rendered_post = @post.dup
48
+ do_render(@rendered_post)
49
+ @extracted_excerpt = @rendered_post.send :extracted_excerpt
50
+ end
51
+
52
+ should "be the first paragraph of the page" do
53
+ assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>", @extracted_excerpt.content
54
+ end
55
+
56
+ should "link properly" do
57
+ assert @extracted_excerpt.content.include?("http://www.jekyllrb.com/")
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  should "ensure post count is as expected" do
17
- assert_equal 34, @site.posts.size
17
+ assert_equal 35, @site.posts.size
18
18
  end
19
19
 
20
20
  should "insert site.posts into the index" do
@@ -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
@@ -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'))
@@ -12,49 +23,32 @@ class TestPager < Test::Unit::TestCase
12
23
  end
13
24
 
14
25
  should "determine the pagination path" do
15
- assert_nil(Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 1))
16
- assert_equal("page2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 2))
17
- assert_nil(Pager.paginate_path(Jekyll::Configuration::DEFAULTS.merge('paginate_path' => '/blog/page-:num'), 1))
18
- assert_equal("page-2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS.merge('paginate_path' => '/blog/page-:num'), 2))
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))
19
36
  end
20
37
 
21
38
  context "pagination disabled" do
22
- setup do
23
- stub(Jekyll).configuration do
24
- Jekyll::Configuration::DEFAULTS.merge({
25
- 'source' => source_dir,
26
- 'destination' => dest_dir
27
- })
28
- end
29
- @config = Jekyll.configuration
30
- end
31
-
32
39
  should "report that pagination is disabled" do
33
- page = OpenStruct.new({ :name => 'index.html', :dir => '/' })
34
- assert !Pager.pagination_enabled?(@config, page)
40
+ assert !Pager.pagination_enabled?(build_site('paginate' => nil))
35
41
  end
36
-
37
42
  end
38
43
 
39
44
  context "pagination enabled for 2" do
40
45
  setup do
41
- stub(Jekyll).configuration do
42
- Jekyll::Configuration::DEFAULTS.merge({
43
- 'source' => source_dir,
44
- 'destination' => dest_dir,
45
- 'paginate' => 2
46
- })
47
- end
48
-
49
- @config = Jekyll.configuration
50
- @site = Site.new(@config)
51
- @site.process
46
+ @site = build_site('paginate' => 2)
52
47
  @posts = @site.posts
53
48
  end
54
49
 
55
50
  should "report that pagination is enabled" do
56
- page = OpenStruct.new({ :name => 'index.html', :dir => '/' })
57
- assert Pager.pagination_enabled?(@config, page)
51
+ assert Pager.pagination_enabled?(@site)
58
52
  end
59
53
 
60
54
  context "with 4 posts" do
@@ -63,7 +57,7 @@ class TestPager < Test::Unit::TestCase
63
57
  end
64
58
 
65
59
  should "create first pager" do
66
- pager = Pager.new(@config, 1, @posts)
60
+ pager = Pager.new(@site, 1, @posts)
67
61
  assert_equal(2, pager.posts.size)
68
62
  assert_equal(2, pager.total_pages)
69
63
  assert_nil(pager.previous_page)
@@ -71,7 +65,7 @@ class TestPager < Test::Unit::TestCase
71
65
  end
72
66
 
73
67
  should "create second pager" do
74
- pager = Pager.new(@config, 2, @posts)
68
+ pager = Pager.new(@site, 2, @posts)
75
69
  assert_equal(2, pager.posts.size)
76
70
  assert_equal(2, pager.total_pages)
77
71
  assert_equal(1, pager.previous_page)
@@ -79,7 +73,7 @@ class TestPager < Test::Unit::TestCase
79
73
  end
80
74
 
81
75
  should "not create third pager" do
82
- assert_raise(RuntimeError) { Pager.new(@config, 3, @posts) }
76
+ assert_raise(RuntimeError) { Pager.new(@site, 3, @posts) }
83
77
  end
84
78
 
85
79
  end
@@ -90,7 +84,7 @@ class TestPager < Test::Unit::TestCase
90
84
  end
91
85
 
92
86
  should "create first pager" do
93
- pager = Pager.new(@config, 1, @posts)
87
+ pager = Pager.new(@site, 1, @posts)
94
88
  assert_equal(2, pager.posts.size)
95
89
  assert_equal(3, pager.total_pages)
96
90
  assert_nil(pager.previous_page)
@@ -98,7 +92,7 @@ class TestPager < Test::Unit::TestCase
98
92
  end
99
93
 
100
94
  should "create second pager" do
101
- pager = Pager.new(@config, 2, @posts)
95
+ pager = Pager.new(@site, 2, @posts)
102
96
  assert_equal(2, pager.posts.size)
103
97
  assert_equal(3, pager.total_pages)
104
98
  assert_equal(1, pager.previous_page)
@@ -106,7 +100,7 @@ class TestPager < Test::Unit::TestCase
106
100
  end
107
101
 
108
102
  should "create third pager" do
109
- pager = Pager.new(@config, 3, @posts)
103
+ pager = Pager.new(@site, 3, @posts)
110
104
  assert_equal(1, pager.posts.size)
111
105
  assert_equal(3, pager.total_pages)
112
106
  assert_equal(2, pager.previous_page)
@@ -114,7 +108,7 @@ class TestPager < Test::Unit::TestCase
114
108
  end
115
109
 
116
110
  should "not create fourth pager" do
117
- assert_raise(RuntimeError) { Pager.new(@config, 4, @posts) }
111
+ assert_raise(RuntimeError) { Pager.new(@site, 4, @posts) }
118
112
  end
119
113
 
120
114
  end
@@ -267,9 +267,10 @@ class TestPost < Test::Unit::TestCase
267
267
  context "#excerpt" do
268
268
  setup do
269
269
  file = "2013-01-02-post-excerpt.markdown"
270
+ @post = setup_post(file)
270
271
  @post.process(file)
271
272
  @post.read_yaml(@source, file)
272
- @post.transform
273
+ do_render(@post)
273
274
  end
274
275
 
275
276
  should "return first paragraph by default" do