jekyll 0.5.6 → 0.5.7
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.
- data/History.txt +10 -0
- data/VERSION.yml +1 -1
- data/features/embed_filters.feature +3 -3
- data/features/markdown.feature +30 -0
- data/features/pagination.feature +1 -1
- data/features/post_data.feature +11 -11
- data/jekyll.gemspec +11 -2
- data/lib/jekyll/convertible.rb +4 -0
- data/lib/jekyll/core_ext.rb +22 -0
- data/lib/jekyll/page.rb +5 -1
- data/lib/jekyll/post.rb +12 -24
- data/lib/jekyll/site.rb +30 -20
- data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
- data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
- data/test/source/_posts/2010-01-09-date-override.textile +5 -0
- data/test/source/_posts/2010-01-09-time-override.textile +5 -0
- data/test/test_core_ext.rb +66 -0
- data/test/test_generated_site.rb +1 -1
- data/test/test_post.rb +31 -0
- metadata +11 -2
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 0.5.7 / 2010-01-12
|
2
|
+
* Minor Enhancements
|
3
|
+
* Allow overriding of post date in the front matter (#62, #38)
|
4
|
+
* Bug Fixes
|
5
|
+
* Categories isn't always an array (#73)
|
6
|
+
* Empty tags causes error in read_posts (#84)
|
7
|
+
* Fix pagination to adhere to read/render/write paradigm
|
8
|
+
* Test Enhancement
|
9
|
+
* cucumber features no longer use site.ports.first where a better alternative is available
|
10
|
+
|
1
11
|
== 0.5.6 / 2010-01-08
|
2
12
|
* Bug Fixes
|
3
13
|
* Require redcloth >= 4.2.1 in tests (#92)
|
data/VERSION.yml
CHANGED
@@ -20,7 +20,7 @@ Feature: Embed filters
|
|
20
20
|
And I have the following post:
|
21
21
|
| title | date | layout | content |
|
22
22
|
| Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
|
23
|
-
And I have a default layout that contains "{{
|
23
|
+
And I have a default layout that contains "{{ page.title | xml_escape }}"
|
24
24
|
When I run jekyll
|
25
25
|
Then the _site directory should exist
|
26
26
|
And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html"
|
@@ -31,7 +31,7 @@ Feature: Embed filters
|
|
31
31
|
And I have the following post:
|
32
32
|
| title | date | layout | content |
|
33
33
|
| Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
|
34
|
-
And I have a default layout that contains "{{
|
34
|
+
And I have a default layout that contains "{{ content | xml_escape }}"
|
35
35
|
When I run jekyll
|
36
36
|
Then the _site directory should exist
|
37
37
|
And I should see "7" in "_site/2009/03/27/star-wars.html"
|
@@ -42,7 +42,7 @@ Feature: Embed filters
|
|
42
42
|
And I have the following post:
|
43
43
|
| title | date | layout | tags | content |
|
44
44
|
| Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
|
45
|
-
And I have a default layout that contains "{{
|
45
|
+
And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
|
46
46
|
When I run jekyll
|
47
47
|
Then the _site directory should exist
|
48
48
|
And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Markdown
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to make a static site
|
4
|
+
In order to share my awesome ideas with the interwebs
|
5
|
+
|
6
|
+
Scenario: Markdown in list on index
|
7
|
+
Given I have a configuration file with "paginate" set to "5"
|
8
|
+
And I have an "index.html" page that contains "Index - {% for post in site.posts %} {{ post.content }} {% endfor %}"
|
9
|
+
And I have a _posts directory
|
10
|
+
And I have the following post:
|
11
|
+
| title | date | content | type |
|
12
|
+
| Hackers | 3/27/2009 | # My Title | markdown |
|
13
|
+
When I run jekyll
|
14
|
+
Then the _site directory should exist
|
15
|
+
And I should see "Index" in "_site/index.html"
|
16
|
+
And I should see "<h1 id='my_title'>My Title</h1>" in "_site/2009/03/27/hackers.html"
|
17
|
+
And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
|
18
|
+
|
19
|
+
Scenario: Markdown in pagination on index
|
20
|
+
Given I have a configuration file with "paginate" set to "5"
|
21
|
+
And I have an "index.html" page that contains "Index - {% for post in paginator.posts %} {{ post.content }} {% endfor %}"
|
22
|
+
And I have a _posts directory
|
23
|
+
And I have the following post:
|
24
|
+
| title | date | content | type |
|
25
|
+
| Hackers | 3/27/2009 | # My Title | markdown |
|
26
|
+
When I run jekyll
|
27
|
+
Then the _site directory should exist
|
28
|
+
And I should see "Index" in "_site/index.html"
|
29
|
+
And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
|
30
|
+
|
data/features/pagination.feature
CHANGED
@@ -6,7 +6,7 @@ Feature: Site pagination
|
|
6
6
|
Scenario Outline: Paginate with N posts per page
|
7
7
|
Given I have a configuration file with "paginate" set to "<num>"
|
8
8
|
And I have a _layouts directory
|
9
|
-
And I have an "index.html"
|
9
|
+
And I have an "index.html" page that contains "{{ paginator.posts.size }}"
|
10
10
|
And I have a _posts directory
|
11
11
|
And I have the following post:
|
12
12
|
| title | date | layout | content |
|
data/features/post_data.feature
CHANGED
@@ -9,7 +9,7 @@ Feature: Post data
|
|
9
9
|
And I have the following post:
|
10
10
|
| title | date | layout | content |
|
11
11
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
12
|
-
And I have a simple layout that contains "Post title: {{
|
12
|
+
And I have a simple layout that contains "Post title: {{ page.title }}"
|
13
13
|
When I run jekyll
|
14
14
|
Then the _site directory should exist
|
15
15
|
And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html"
|
@@ -20,7 +20,7 @@ Feature: Post data
|
|
20
20
|
And I have the following post:
|
21
21
|
| title | date | layout | content |
|
22
22
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
23
|
-
And I have a simple layout that contains "Post url: {{
|
23
|
+
And I have a simple layout that contains "Post url: {{ page.url }}"
|
24
24
|
When I run jekyll
|
25
25
|
Then the _site directory should exist
|
26
26
|
And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html"
|
@@ -31,7 +31,7 @@ Feature: Post data
|
|
31
31
|
And I have the following post:
|
32
32
|
| title | date | layout | content |
|
33
33
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
34
|
-
And I have a simple layout that contains "Post date: {{
|
34
|
+
And I have a simple layout that contains "Post date: {{ page.date }}"
|
35
35
|
When I run jekyll
|
36
36
|
Then the _site directory should exist
|
37
37
|
And I should see "Post date: Fri Mar 27" in "_site/2009/03/27/star-wars.html"
|
@@ -42,7 +42,7 @@ Feature: Post data
|
|
42
42
|
And I have the following post:
|
43
43
|
| title | date | layout | content |
|
44
44
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
45
|
-
And I have a simple layout that contains "Post id: {{
|
45
|
+
And I have a simple layout that contains "Post id: {{ page.id }}"
|
46
46
|
When I run jekyll
|
47
47
|
Then the _site directory should exist
|
48
48
|
And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html"
|
@@ -53,7 +53,7 @@ Feature: Post data
|
|
53
53
|
And I have the following post:
|
54
54
|
| title | date | layout | content |
|
55
55
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
56
|
-
And I have a simple layout that contains "Post content: {{
|
56
|
+
And I have a simple layout that contains "Post content: {{ content }}"
|
57
57
|
When I run jekyll
|
58
58
|
Then the _site directory should exist
|
59
59
|
And I should see "Post content: <p>Luke, I am your father.</p>" in "_site/2009/03/27/star-wars.html"
|
@@ -65,7 +65,7 @@ Feature: Post data
|
|
65
65
|
And I have the following post in "movies":
|
66
66
|
| title | date | layout | content |
|
67
67
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
68
|
-
And I have a simple layout that contains "Post category: {{
|
68
|
+
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
69
69
|
When I run jekyll
|
70
70
|
Then the _site directory should exist
|
71
71
|
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
@@ -76,7 +76,7 @@ Feature: Post data
|
|
76
76
|
And I have the following post:
|
77
77
|
| title | date | layout | tag | content |
|
78
78
|
| Star Wars | 5/18/2009 | simple | twist | Luke, I am your father. |
|
79
|
-
And I have a simple layout that contains "Post tags: {{
|
79
|
+
And I have a simple layout that contains "Post tags: {{ page.tags }}"
|
80
80
|
When I run jekyll
|
81
81
|
Then the _site directory should exist
|
82
82
|
And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html"
|
@@ -89,7 +89,7 @@ Feature: Post data
|
|
89
89
|
And I have the following post in "movies/scifi":
|
90
90
|
| title | date | layout | content |
|
91
91
|
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
92
|
-
And I have a simple layout that contains "Post categories: {{
|
92
|
+
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
|
93
93
|
When I run jekyll
|
94
94
|
Then the _site directory should exist
|
95
95
|
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
@@ -100,7 +100,7 @@ Feature: Post data
|
|
100
100
|
And I have the following post:
|
101
101
|
| title | date | layout | category | content |
|
102
102
|
| Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. |
|
103
|
-
And I have a simple layout that contains "Post category: {{
|
103
|
+
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
104
104
|
When I run jekyll
|
105
105
|
Then the _site directory should exist
|
106
106
|
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
@@ -111,7 +111,7 @@ Feature: Post data
|
|
111
111
|
And I have the following post:
|
112
112
|
| title | date | layout | categories | content |
|
113
113
|
| Star Wars | 3/27/2009 | simple | ['movies', 'scifi'] | Luke, I am your father. |
|
114
|
-
And I have a simple layout that contains "Post categories: {{
|
114
|
+
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
|
115
115
|
When I run jekyll
|
116
116
|
Then the _site directory should exist
|
117
117
|
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
@@ -133,7 +133,7 @@ Feature: Post data
|
|
133
133
|
And I have the following post:
|
134
134
|
| title | date | layout | author | content |
|
135
135
|
| Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. |
|
136
|
-
And I have a simple layout that contains "Post author: {{
|
136
|
+
And I have a simple layout that contains "Post author: {{ page.author }}"
|
137
137
|
When I run jekyll
|
138
138
|
Then the _site directory should exist
|
139
139
|
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
|
data/jekyll.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jekyll}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom Preston-Werner"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-12}
|
13
13
|
s.default_executable = %q{jekyll}
|
14
14
|
s.description = %q{Jekyll is a simple, blog aware, static site generator.}
|
15
15
|
s.email = %q{tom@mojombo.com}
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"bin/jekyll",
|
27
27
|
"features/create_sites.feature",
|
28
28
|
"features/embed_filters.feature",
|
29
|
+
"features/markdown.feature",
|
29
30
|
"features/pagination.feature",
|
30
31
|
"features/permalinks.feature",
|
31
32
|
"features/post_data.feature",
|
@@ -66,12 +67,18 @@ Gem::Specification.new do |s|
|
|
66
67
|
"test/source/_posts/2009-01-27-array-categories.textile",
|
67
68
|
"test/source/_posts/2009-01-27-categories.textile",
|
68
69
|
"test/source/_posts/2009-01-27-category.textile",
|
70
|
+
"test/source/_posts/2009-01-27-empty-categories.textile",
|
71
|
+
"test/source/_posts/2009-01-27-empty-category.textile",
|
69
72
|
"test/source/_posts/2009-03-12-hash-#1.markdown",
|
73
|
+
"test/source/_posts/2009-05-18-empty-tag.textile",
|
74
|
+
"test/source/_posts/2009-05-18-empty-tags.textile",
|
70
75
|
"test/source/_posts/2009-05-18-tag.textile",
|
71
76
|
"test/source/_posts/2009-05-18-tags.textile",
|
72
77
|
"test/source/_posts/2009-06-22-empty-yaml.textile",
|
73
78
|
"test/source/_posts/2009-06-22-no-yaml.textile",
|
74
79
|
"test/source/_posts/2010-01-08-triple-dash.markdown",
|
80
|
+
"test/source/_posts/2010-01-09-date-override.textile",
|
81
|
+
"test/source/_posts/2010-01-09-time-override.textile",
|
75
82
|
"test/source/about.html",
|
76
83
|
"test/source/category/_posts/2008-9-23-categories.textile",
|
77
84
|
"test/source/contacts.html",
|
@@ -83,6 +90,7 @@ Gem::Specification.new do |s|
|
|
83
90
|
"test/source/z_category/_posts/2008-9-23-categories.textile",
|
84
91
|
"test/suite.rb",
|
85
92
|
"test/test_configuration.rb",
|
93
|
+
"test/test_core_ext.rb",
|
86
94
|
"test/test_filters.rb",
|
87
95
|
"test/test_generated_site.rb",
|
88
96
|
"test/test_page.rb",
|
@@ -101,6 +109,7 @@ Gem::Specification.new do |s|
|
|
101
109
|
"test/helper.rb",
|
102
110
|
"test/suite.rb",
|
103
111
|
"test/test_configuration.rb",
|
112
|
+
"test/test_core_ext.rb",
|
104
113
|
"test/test_filters.rb",
|
105
114
|
"test/test_generated_site.rb",
|
106
115
|
"test/test_page.rb",
|
data/lib/jekyll/convertible.rb
CHANGED
data/lib/jekyll/core_ext.rb
CHANGED
@@ -19,6 +19,28 @@ class Hash
|
|
19
19
|
|
20
20
|
target
|
21
21
|
end
|
22
|
+
|
23
|
+
# Read array from the supplied hash favouring the singular key
|
24
|
+
# and then the plural key, and handling any nil entries.
|
25
|
+
# +hash+ the hash to read from
|
26
|
+
# +singular_key+ the singular key
|
27
|
+
# +plural_key+ the singular key
|
28
|
+
#
|
29
|
+
# Returns an array
|
30
|
+
def pluralized_array(singular_key, plural_key)
|
31
|
+
hash = self
|
32
|
+
if hash.has_key?(singular_key)
|
33
|
+
array = [hash[singular_key]] if hash[singular_key]
|
34
|
+
elsif hash.has_key?(plural_key)
|
35
|
+
case hash[plural_key]
|
36
|
+
when String
|
37
|
+
array = hash[plural_key].split
|
38
|
+
when Array
|
39
|
+
array = hash[plural_key].compact
|
40
|
+
end
|
41
|
+
end
|
42
|
+
array || []
|
43
|
+
end
|
22
44
|
end
|
23
45
|
|
24
46
|
# Thanks, ActiveSupport!
|
data/lib/jekyll/page.rb
CHANGED
@@ -4,7 +4,7 @@ module Jekyll
|
|
4
4
|
include Convertible
|
5
5
|
|
6
6
|
attr_accessor :site
|
7
|
-
attr_accessor :name, :ext, :basename
|
7
|
+
attr_accessor :name, :ext, :basename, :dir
|
8
8
|
attr_accessor :data, :content, :output
|
9
9
|
|
10
10
|
# Initialize a new Page.
|
@@ -101,6 +101,10 @@ module Jekyll
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def inspect
|
105
|
+
"#<Jekyll:Page @name=#{self.name.inspect}>"
|
106
|
+
end
|
107
|
+
|
104
108
|
private
|
105
109
|
|
106
110
|
def index?
|
data/lib/jekyll/post.rb
CHANGED
@@ -18,12 +18,9 @@ module Jekyll
|
|
18
18
|
name =~ MATCHER
|
19
19
|
end
|
20
20
|
|
21
|
-
attr_accessor :site
|
22
|
-
|
23
|
-
|
24
|
-
def categories
|
25
|
-
@categories ||= []
|
26
|
-
end
|
21
|
+
attr_accessor :site
|
22
|
+
attr_accessor :data, :content, :output, :ext
|
23
|
+
attr_accessor :date, :slug, :published, :tags, :categories
|
27
24
|
|
28
25
|
# Initialize this Post instance.
|
29
26
|
# +site+ is the Site
|
@@ -41,32 +38,23 @@ module Jekyll
|
|
41
38
|
self.process(name)
|
42
39
|
self.read_yaml(@base, name)
|
43
40
|
|
41
|
+
#If we've added a date and time to the yaml, use that instead of the filename date
|
42
|
+
#Means we'll sort correctly.
|
43
|
+
if self.data.has_key?('date')
|
44
|
+
# ensure Time via to_s and reparse
|
45
|
+
self.date = Time.parse(self.data["date"].to_s)
|
46
|
+
end
|
47
|
+
|
44
48
|
if self.data.has_key?('published') && self.data['published'] == false
|
45
49
|
self.published = false
|
46
50
|
else
|
47
51
|
self.published = true
|
48
52
|
end
|
49
53
|
|
50
|
-
|
51
|
-
self.tags = [self.data["tag"]]
|
52
|
-
elsif self.data.has_key?("tags")
|
53
|
-
self.tags = self.data['tags']
|
54
|
-
else
|
55
|
-
self.tags = []
|
56
|
-
end
|
54
|
+
self.tags = self.data.pluralized_array("tag", "tags")
|
57
55
|
|
58
56
|
if self.categories.empty?
|
59
|
-
|
60
|
-
self.categories << self.data['category']
|
61
|
-
elsif self.data.has_key?('categories')
|
62
|
-
# Look for categories in the YAML-header, either specified as
|
63
|
-
# an array or a string.
|
64
|
-
if self.data['categories'].kind_of? String
|
65
|
-
self.categories = self.data['categories'].split
|
66
|
-
else
|
67
|
-
self.categories = self.data['categories']
|
68
|
-
end
|
69
|
-
end
|
57
|
+
self.categories = self.data.pluralized_array('category', 'categories')
|
70
58
|
end
|
71
59
|
end
|
72
60
|
|
data/lib/jekyll/site.rb
CHANGED
@@ -147,8 +147,16 @@ module Jekyll
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def render
|
150
|
-
|
151
|
-
|
150
|
+
self.posts.each do |post|
|
151
|
+
post.render(self.layouts, site_payload)
|
152
|
+
end
|
153
|
+
|
154
|
+
self.pages.dup.each do |page|
|
155
|
+
if Pager.pagination_enabled?(self.config, page.name)
|
156
|
+
paginate(page)
|
157
|
+
else
|
158
|
+
page.render(self.layouts, site_payload)
|
159
|
+
end
|
152
160
|
end
|
153
161
|
|
154
162
|
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a} }
|
@@ -191,17 +199,13 @@ module Jekyll
|
|
191
199
|
next if self.dest.sub(/\/$/, '') == f_abs
|
192
200
|
read_directories(f_rel)
|
193
201
|
elsif !File.symlink?(f_abs)
|
194
|
-
|
195
|
-
|
202
|
+
first3 = File.open(f_abs) { |fd| fd.read(3) }
|
203
|
+
if first3 == "---"
|
204
|
+
# file appears to have a YAML header so process it as a page
|
205
|
+
pages << Page.new(self, self.source, dir, f)
|
196
206
|
else
|
197
|
-
|
198
|
-
|
199
|
-
# file appears to have a YAML header so process it as a page
|
200
|
-
pages << Page.new(self, self.source, dir, f)
|
201
|
-
else
|
202
|
-
# otherwise treat it as a static file
|
203
|
-
static_files << StaticFile.new(self, self.source, dir, f)
|
204
|
-
end
|
207
|
+
# otherwise treat it as a static file
|
208
|
+
static_files << StaticFile.new(self, self.source, dir, f)
|
205
209
|
end
|
206
210
|
end
|
207
211
|
end
|
@@ -244,8 +248,10 @@ module Jekyll
|
|
244
248
|
end
|
245
249
|
end
|
246
250
|
|
247
|
-
# Paginates the blog's posts. Renders the index.html file into paginated
|
248
|
-
# and adds more
|
251
|
+
# Paginates the blog's posts. Renders the index.html file into paginated
|
252
|
+
# directories, ie: page2/index.html, page3/index.html, etc and adds more
|
253
|
+
# site-wide data.
|
254
|
+
# +page+ is the index.html Page that requires pagination
|
249
255
|
#
|
250
256
|
# {"paginator" => { "page" => <Number>,
|
251
257
|
# "per_page" => <Number>,
|
@@ -254,15 +260,19 @@ module Jekyll
|
|
254
260
|
# "total_pages" => <Number>,
|
255
261
|
# "previous_page" => <Number>,
|
256
262
|
# "next_page" => <Number> }}
|
257
|
-
def
|
258
|
-
all_posts =
|
263
|
+
def paginate(page)
|
264
|
+
all_posts = site_payload['site']['posts']
|
259
265
|
pages = Pager.calculate_pages(all_posts, self.config['paginate'].to_i)
|
260
266
|
(1..pages).each do |num_page|
|
261
267
|
pager = Pager.new(self.config, num_page, all_posts, pages)
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
268
|
+
if num_page > 1
|
269
|
+
newpage = Page.new(self, self.source, page.dir, page.name)
|
270
|
+
newpage.render(self.layouts, site_payload.merge({'paginator' => pager.to_hash}))
|
271
|
+
newpage.dir = File.join(page.dir, "page#{num_page}")
|
272
|
+
self.pages << newpage
|
273
|
+
else
|
274
|
+
page.render(self.layouts, site_payload.merge({'paginator' => pager.to_hash}))
|
275
|
+
end
|
266
276
|
end
|
267
277
|
end
|
268
278
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestCoreExt < Test::Unit::TestCase
|
4
|
+
context "hash" do
|
5
|
+
|
6
|
+
context "pluralized_array" do
|
7
|
+
|
8
|
+
should "return empty array with no values" do
|
9
|
+
data = {}
|
10
|
+
assert_equal [], data.pluralized_array('tag', 'tags')
|
11
|
+
end
|
12
|
+
|
13
|
+
should "return empty array with no matching values" do
|
14
|
+
data = { 'foo' => 'bar' }
|
15
|
+
assert_equal [], data.pluralized_array('tag', 'tags')
|
16
|
+
end
|
17
|
+
|
18
|
+
should "return empty array with matching nil singular" do
|
19
|
+
data = { 'foo' => 'bar', 'tag' => nil, 'tags' => ['dog', 'cat'] }
|
20
|
+
assert_equal [], data.pluralized_array('tag', 'tags')
|
21
|
+
end
|
22
|
+
|
23
|
+
should "return single value array with matching singular" do
|
24
|
+
data = { 'foo' => 'bar', 'tag' => 'dog', 'tags' => ['dog', 'cat'] }
|
25
|
+
assert_equal ['dog'], data.pluralized_array('tag', 'tags')
|
26
|
+
end
|
27
|
+
|
28
|
+
should "return single value array with matching singular with spaces" do
|
29
|
+
data = { 'foo' => 'bar', 'tag' => 'dog cat', 'tags' => ['dog', 'cat'] }
|
30
|
+
assert_equal ['dog cat'], data.pluralized_array('tag', 'tags')
|
31
|
+
end
|
32
|
+
|
33
|
+
should "return empty array with matching nil plural" do
|
34
|
+
data = { 'foo' => 'bar', 'tags' => nil }
|
35
|
+
assert_equal [], data.pluralized_array('tag', 'tags')
|
36
|
+
end
|
37
|
+
|
38
|
+
should "return empty array with matching empty array" do
|
39
|
+
data = { 'foo' => 'bar', 'tags' => [] }
|
40
|
+
assert_equal [], data.pluralized_array('tag', 'tags')
|
41
|
+
end
|
42
|
+
|
43
|
+
should "return single value array with matching plural with single string value" do
|
44
|
+
data = { 'foo' => 'bar', 'tags' => 'dog' }
|
45
|
+
assert_equal ['dog'], data.pluralized_array('tag', 'tags')
|
46
|
+
end
|
47
|
+
|
48
|
+
should "return multiple value array with matching plural with single string value with spaces" do
|
49
|
+
data = { 'foo' => 'bar', 'tags' => 'dog cat' }
|
50
|
+
assert_equal ['dog', 'cat'], data.pluralized_array('tag', 'tags')
|
51
|
+
end
|
52
|
+
|
53
|
+
should "return single value array with matching plural with single value array" do
|
54
|
+
data = { 'foo' => 'bar', 'tags' => ['dog'] }
|
55
|
+
assert_equal ['dog'], data.pluralized_array('tag', 'tags')
|
56
|
+
end
|
57
|
+
|
58
|
+
should "return multiple value array with matching plural with multiple value array" do
|
59
|
+
data = { 'foo' => 'bar', 'tags' => ['dog', 'cat'] }
|
60
|
+
assert_equal ['dog', 'cat'], data.pluralized_array('tag', 'tags')
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
data/test/test_generated_site.rb
CHANGED
data/test/test_post.rb
CHANGED
@@ -36,6 +36,7 @@ class TestPost < Test::Unit::TestCase
|
|
36
36
|
end
|
37
37
|
|
38
38
|
should "keep date, title, and markup type" do
|
39
|
+
@post.categories = []
|
39
40
|
@post.process(@fake_file)
|
40
41
|
|
41
42
|
assert_equal Time.parse("2008-10-19"), @post.date
|
@@ -224,6 +225,16 @@ class TestPost < Test::Unit::TestCase
|
|
224
225
|
assert_equal false, post.published
|
225
226
|
end
|
226
227
|
|
228
|
+
should "recognize date in yaml" do
|
229
|
+
post = setup_post("2010-01-09-date-override.textile")
|
230
|
+
assert_equal "/2010/01/10/date-override.html", post.url
|
231
|
+
end
|
232
|
+
|
233
|
+
should "recognize time in yaml" do
|
234
|
+
post = setup_post("2010-01-09-time-override.textile")
|
235
|
+
assert_equal "/2010/01/10/time-override.html", post.url
|
236
|
+
end
|
237
|
+
|
227
238
|
should "recognize category in yaml" do
|
228
239
|
post = setup_post("2009-01-27-category.textile")
|
229
240
|
assert post.categories.include?('foo')
|
@@ -236,6 +247,16 @@ class TestPost < Test::Unit::TestCase
|
|
236
247
|
assert post.categories.include?('baz')
|
237
248
|
end
|
238
249
|
|
250
|
+
should "recognize empty category in yaml" do
|
251
|
+
post = setup_post("2009-01-27-empty-category.textile")
|
252
|
+
assert_equal [], post.categories
|
253
|
+
end
|
254
|
+
|
255
|
+
should "recognize empty categories in yaml" do
|
256
|
+
post = setup_post("2009-01-27-empty-categories.textile")
|
257
|
+
assert_equal [], post.categories
|
258
|
+
end
|
259
|
+
|
239
260
|
should "recognize tag in yaml" do
|
240
261
|
post = setup_post("2009-05-18-tag.textile")
|
241
262
|
assert post.tags.include?('code')
|
@@ -248,6 +269,16 @@ class TestPost < Test::Unit::TestCase
|
|
248
269
|
assert post.tags.include?('pizza')
|
249
270
|
end
|
250
271
|
|
272
|
+
should "recognize empty tag in yaml" do
|
273
|
+
post = setup_post("2009-05-18-empty-tag.textile")
|
274
|
+
assert_equal [], post.tags
|
275
|
+
end
|
276
|
+
|
277
|
+
should "recognize empty tags in yaml" do
|
278
|
+
post = setup_post("2009-05-18-empty-tags.textile")
|
279
|
+
assert_equal [], post.tags
|
280
|
+
end
|
281
|
+
|
251
282
|
should "allow no yaml" do
|
252
283
|
post = setup_post("2009-06-22-no-yaml.textile")
|
253
284
|
assert_equal "No YAML.", post.content
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-12 00:00:00 -08:00
|
13
13
|
default_executable: jekyll
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- bin/jekyll
|
90
90
|
- features/create_sites.feature
|
91
91
|
- features/embed_filters.feature
|
92
|
+
- features/markdown.feature
|
92
93
|
- features/pagination.feature
|
93
94
|
- features/permalinks.feature
|
94
95
|
- features/post_data.feature
|
@@ -129,12 +130,18 @@ files:
|
|
129
130
|
- test/source/_posts/2009-01-27-array-categories.textile
|
130
131
|
- test/source/_posts/2009-01-27-categories.textile
|
131
132
|
- test/source/_posts/2009-01-27-category.textile
|
133
|
+
- test/source/_posts/2009-01-27-empty-categories.textile
|
134
|
+
- test/source/_posts/2009-01-27-empty-category.textile
|
132
135
|
- test/source/_posts/2009-03-12-hash-#1.markdown
|
136
|
+
- test/source/_posts/2009-05-18-empty-tag.textile
|
137
|
+
- test/source/_posts/2009-05-18-empty-tags.textile
|
133
138
|
- test/source/_posts/2009-05-18-tag.textile
|
134
139
|
- test/source/_posts/2009-05-18-tags.textile
|
135
140
|
- test/source/_posts/2009-06-22-empty-yaml.textile
|
136
141
|
- test/source/_posts/2009-06-22-no-yaml.textile
|
137
142
|
- test/source/_posts/2010-01-08-triple-dash.markdown
|
143
|
+
- test/source/_posts/2010-01-09-date-override.textile
|
144
|
+
- test/source/_posts/2010-01-09-time-override.textile
|
138
145
|
- test/source/about.html
|
139
146
|
- test/source/category/_posts/2008-9-23-categories.textile
|
140
147
|
- test/source/contacts.html
|
@@ -146,6 +153,7 @@ files:
|
|
146
153
|
- test/source/z_category/_posts/2008-9-23-categories.textile
|
147
154
|
- test/suite.rb
|
148
155
|
- test/test_configuration.rb
|
156
|
+
- test/test_core_ext.rb
|
149
157
|
- test/test_filters.rb
|
150
158
|
- test/test_generated_site.rb
|
151
159
|
- test/test_page.rb
|
@@ -185,6 +193,7 @@ test_files:
|
|
185
193
|
- test/helper.rb
|
186
194
|
- test/suite.rb
|
187
195
|
- test/test_configuration.rb
|
196
|
+
- test/test_core_ext.rb
|
188
197
|
- test/test_filters.rb
|
189
198
|
- test/test_generated_site.rb
|
190
199
|
- test/test_page.rb
|